Skip to content

Commit f56bba1

Browse files
author
Gusted
authored
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)
1 parent c9da11c commit f56bba1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

models/repo/repo.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,14 @@ func (repo *Repository) LoadUnits(ctx context.Context) (err error) {
290290
}
291291

292292
repo.Units, err = getUnitsByRepoID(db.GetEngine(ctx), repo.ID)
293-
log.Trace("repo.Units: %-+v", repo.Units)
293+
if log.IsTrace() {
294+
unitTypeStrings := make([]string, len(repo.Units))
295+
for i, unit := range repo.Units {
296+
unitTypeStrings[i] = unit.Type.String()
297+
}
298+
log.Trace("repo.Units, ID=%d, Types: [%s]", repo.ID, strings.Join(unitTypeStrings, ", "))
299+
}
300+
294301
return err
295302
}
296303

0 commit comments

Comments
 (0)