Skip to content

Commit f5c1bb9

Browse files
committed
fix: improve formatting of commands printed in logs for debugability
1 parent d7c57a8 commit f5c1bb9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/restic/restic.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (r *Repo) commandWithContext(ctx context.Context, args []string, opts ...Ge
6969
sw := &ioutil.SynchronizedWriter{W: logger}
7070
cmd.Stderr = sw
7171
cmd.Stdout = sw
72-
fmt.Fprintf(logger, "\ncommand: %v %v\n", fullCmd[0], strings.Join(fullCmd[1:], " "))
72+
fmt.Fprintf(logger, "\ncommand: %q\n", fullCmd)
7373
}
7474

7575
return cmd
@@ -174,7 +174,7 @@ func (r *Repo) Backup(ctx context.Context, paths []string, progressCallback func
174174

175175
// Ensure the command is logged since we're overriding the logger
176176
if logger != nil {
177-
fmt.Fprintf(logger, "command: %v %v\n", cmd.Path, strings.Join(cmd.Args, " "))
177+
fmt.Fprintf(logger, "command: %q\n", cmd)
178178
}
179179

180180
buf := buffer.New(32 * 1024) // 32KB IO buffer for the realtime event parsing

0 commit comments

Comments
 (0)