aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGusted2022-02-27 15:49:22 +0000
committerGitHub2022-02-27 15:49:22 +0000
commitf56bba1a7823168f038cc4bd847c51771ca73bc9 (patch)
tree2feec2d81a45c10d7a2688075bf67eaa76644bcb
parentc9da11c6b2c5449b762a4d8458fbbccc5f100b94 (diff)
Fix trace log to show value instead of pointers (#18926)
- Fixes a issue with a trace of repo.Units whereby it would show the pointers. Before: ![image](https://user-images.githubusercontent.com/25481501/155876811-036bf40e-db89-4e09-ac00-0c78ce3f5bef.png) After: ![image](https://user-images.githubusercontent.com/25481501/155885102-16c9cf29-314b-4f32-bcee-80e332f63dec.png)
-rw-r--r--models/repo/repo.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/models/repo/repo.go b/models/repo/repo.go
index 28d976773..156ead405 100644
--- a/models/repo/repo.go
+++ b/models/repo/repo.go
@@ -290,7 +290,14 @@ func (repo *Repository) LoadUnits(ctx context.Context) (err error) {
}
repo.Units, err = getUnitsByRepoID(db.GetEngine(ctx), repo.ID)
- log.Trace("repo.Units: %-+v", repo.Units)
+ if log.IsTrace() {
+ unitTypeStrings := make([]string, len(repo.Units))
+ for i, unit := range repo.Units {
+ unitTypeStrings[i] = unit.Type.String()
+ }
+ log.Trace("repo.Units, ID=%d, Types: [%s]", repo.ID, strings.Join(unitTypeStrings, ", "))
+ }
+
return err
}