engine: graph: autoedge: Clean up redundant logs

They repeat themselves, this is cleaner.
This commit is contained in:
James Shubin
2024-12-03 00:56:22 -05:00
parent 5764c977f1
commit 097efdd66a
2 changed files with 13 additions and 13 deletions

View File

@@ -39,7 +39,7 @@ import (
// AutoEdge adds the automatic edges to the graph. // AutoEdge adds the automatic edges to the graph.
func AutoEdge(graph *pgraph.Graph, debug bool, logf func(format string, v ...interface{})) error { func AutoEdge(graph *pgraph.Graph, debug bool, logf func(format string, v ...interface{})) error {
logf("adding autoedges...") logf("building...")
// initially get all of the autoedges to seek out all possible errors // initially get all of the autoedges to seek out all possible errors
var err error var err error
@@ -88,9 +88,9 @@ func AutoEdge(graph *pgraph.Graph, debug bool, logf func(format string, v ...int
break // inner loop break // inner loop
} }
if debug { if debug {
logf("autoedge: UIDS:") logf("UIDS:")
for i, u := range uids { for i, u := range uids {
logf("autoedge: UID%d: %v", i, u) logf("UID%d: %v", i, u)
} }
} }
@@ -131,7 +131,7 @@ func addEdgesByMatchingUIDS(res engine.EdgeableRes, uids []engine.ResUID, graph
continue continue
} }
if debug { if debug {
logf("autoedge: Match: %s with UID: %s", r, uid) logf("match: %s with UID: %s", r, uid)
} }
// we must match to an effective UID for the resource, // we must match to an effective UID for the resource,
// that is to say, the name value of a res is a helpful // that is to say, the name value of a res is a helpful
@@ -140,13 +140,13 @@ func addEdgesByMatchingUIDS(res engine.EdgeableRes, uids []engine.ResUID, graph
if UIDExistsInUIDs(uid, r.UIDs()) { if UIDExistsInUIDs(uid, r.UIDs()) {
// add edge from: r -> res // add edge from: r -> res
if uid.IsReversed() { if uid.IsReversed() {
txt := fmt.Sprintf("%s -> %s (autoedge)", r, res) txt := fmt.Sprintf("%s -> %s", r, res)
logf("autoedge: adding: %s", txt) logf("adding: %s", txt)
edge := &engine.Edge{Name: txt} edge := &engine.Edge{Name: txt}
graph.AddEdge(r, res, edge) graph.AddEdge(r, res, edge)
} else { // edges go the "normal" way, eg: pkg resource } else { // edges go the "normal" way, eg: pkg resource
txt := fmt.Sprintf("%s -> %s (autoedge)", res, r) txt := fmt.Sprintf("%s -> %s", res, r)
logf("autoedge: adding: %s", txt) logf("adding: %s", txt)
edge := &engine.Edge{Name: txt} edge := &engine.Edge{Name: txt}
graph.AddEdge(res, r, edge) graph.AddEdge(res, r, edge)
} }

View File

@@ -33,11 +33,11 @@ file "/tmp/whole1" {
], ],
} }
-- OUTPUT -- -- OUTPUT --
Edge: file[/tmp/frags/] -> file[/tmp/frags/f1] # file[/tmp/frags/] -> file[/tmp/frags/f1] (autoedge) Edge: file[/tmp/frags/] -> file[/tmp/frags/f1] # file[/tmp/frags/] -> file[/tmp/frags/f1]
Edge: file[/tmp/frags/] -> file[/tmp/frags/f2] # file[/tmp/frags/] -> file[/tmp/frags/f2] (autoedge) Edge: file[/tmp/frags/] -> file[/tmp/frags/f2] # file[/tmp/frags/] -> file[/tmp/frags/f2]
Edge: file[/tmp/frags/] -> file[/tmp/frags/f3] # file[/tmp/frags/] -> file[/tmp/frags/f3] (autoedge) Edge: file[/tmp/frags/] -> file[/tmp/frags/f3] # file[/tmp/frags/] -> file[/tmp/frags/f3]
Edge: file[/tmp/bonus_file] -> file[/tmp/whole1] # file[/tmp/bonus_file] -> file[/tmp/whole1] (autoedge) Edge: file[/tmp/bonus_file] -> file[/tmp/whole1] # file[/tmp/bonus_file] -> file[/tmp/whole1]
Edge: file[/tmp/frags/] -> file[/tmp/whole1] # file[/tmp/frags/] -> file[/tmp/whole1] (autoedge) Edge: file[/tmp/frags/] -> file[/tmp/whole1] # file[/tmp/frags/] -> file[/tmp/whole1]
Vertex: file[/tmp/bonus_file] Vertex: file[/tmp/bonus_file]
Vertex: file[/tmp/frags/] Vertex: file[/tmp/frags/]
Vertex: file[/tmp/frags/f1] Vertex: file[/tmp/frags/f1]