Skip to content

Commit

Permalink
Merge #139700
Browse files Browse the repository at this point in the history
139700: roachprod: respect logger's config specified io.writers r=golgeek a=golgeek

Previously, when NewLogger() was called with an empty path on a Config{} that specifies customs Stdout and Stderr, the logger was still logging to os.Stdout and os.Stderr unless the caller was directly using the exposed Stdout and Stderr writers.

This change uniformizes makes the logger's internal functions `Printf`, and `Errorf` respect the specified configuration, similarly to when a file path is provided.

Epic: none
Release note: None

Co-authored-by: Ludovic Leroux <[email protected]>
  • Loading branch information
craig[bot] and golgeek committed Jan 24, 2025
2 parents da37349 + a46180c commit 5599daf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/roachprod/logger/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ func (cfg *Config) NewLogger(path string) (*Logger, error) {
return &Logger{
Stdout: newSafeWriter(stdout),
Stderr: newSafeWriter(stderr),
stdoutL: log.New(os.Stdout, cfg.Prefix, logFlags),
stderrL: log.New(os.Stderr, cfg.Prefix, logFlags),
stdoutL: log.New(stdout, cfg.Prefix, logFlags),
stderrL: log.New(stderr, cfg.Prefix, logFlags),
}, nil
}

Expand Down

0 comments on commit 5599daf

Please sign in to comment.