Skip to content

Commit

Permalink
log: add SetOutput method on Logger
Browse files Browse the repository at this point in the history
Fixes golang#9629

Change-Id: I66091003b97742ca6d857fe51d609833ab727216
Reviewed-on: https://go-review.googlesource.com/3023
Reviewed-by: Rob Pike <[email protected]>
  • Loading branch information
adg committed Jan 30, 2015
1 parent 7980779 commit 56ba3fb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ func New(out io.Writer, prefix string, flag int) *Logger {
return &Logger{out: out, prefix: prefix, flag: flag}
}

// SetOutput sets the output destination for the logger.
func (l *Logger) SetOutput(w io.Writer) {
l.mu.Lock()
defer l.mu.Unlock()
l.out = w
}

var std = New(os.Stderr, "", LstdFlags)

// Cheap integer to fixed-width decimal ASCII. Give a negative width to avoid zero-padding.
Expand Down

0 comments on commit 56ba3fb

Please sign in to comment.