Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/autoupdate/agent/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ type progressLogger struct {
func (w *progressLogger) Write(p []byte) (n int, err error) {
w.n += len(p)
if w.n >= w.max*(w.l+1)/w.lines {
msg := fmt.Sprintf("%s - progress: %d%%", w.name, w.n*100/w.max)
w.log.Log(w.ctx, w.level, msg) //nolint:sloglint // msg cannot be constant
w.log.Log(w.ctx, w.level, "Downloading",
"file", w.name,
"progress", fmt.Sprintf("%d%%", w.n*100/w.max),
)
w.l++
}
return len(p), nil
Expand Down
2 changes: 1 addition & 1 deletion lib/autoupdate/agent/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestProgressLogger(t *testing.T) {
v, err := io.ReadAll(out)
require.NoError(t, err)
if len(v) > 0 {
e.out = fmt.Sprintf(`msg="test - progress: %s"`+"\n", e.out)
e.out = fmt.Sprintf(`msg=Downloading file=test progress=%s`+"\n", e.out)
}
require.Equal(t, e.out, string(v))
}
Expand Down