Skip to content

Commit

Permalink
Copy output to Stdout for more convenient local development
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Nov 21, 2023
1 parent 71a2b8e commit e7c1c31
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion windows-agent/cmd/ubuntu-pro-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"fmt"
"io"
"os"
"os/signal"
"path/filepath"
Expand Down Expand Up @@ -77,7 +78,10 @@ func setLoggerOutput() (func(), error) {
}

fmt.Fprintf(f, "\n======== Startup %s ========\n", time.Now().Format(time.RFC3339))
log.SetOutput(f)

// Write both to file and to Stdout. The latter is useful for local development.
w := io.MultiWriter(f, os.Stdout)
log.SetOutput(w)

return func() { _ = f.Close() }, nil
}
Expand Down

0 comments on commit e7c1c31

Please sign in to comment.