Skip to content

Commit

Permalink
incusd/instance/qmp: Fix logging with no log file
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Nov 6, 2024
1 parent baa2fad commit 1fef8b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/server/instance/drivers/qmp/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (m *Monitor) RunJSON(request []byte, resp any, logCommand bool) error {
responses := strings.Split(string(out), "\r\n")
out = []byte(responses[len(responses)-1])

if logCommand {
if logCommand && m.logFile != "" {
_, err = fmt.Fprintf(log, "[%s] REPLY: %s\n\n", time.Now().Format(time.RFC3339), out)
if err != nil {
return err
Expand Down

0 comments on commit 1fef8b3

Please sign in to comment.