Skip to content

Commit

Permalink
log: add Writer method to Logger
Browse files Browse the repository at this point in the history
Writer method returns the underlying io.Writer used by the given Logger
object.

Fixes golang#28327
  • Loading branch information
Andrew Poydence authored and poy committed Oct 25, 2018
1 parent 9627180 commit 2db0c5c
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 @@ -254,6 +254,13 @@ func (l *Logger) SetPrefix(prefix string) {
l.prefix = prefix
}

// Writer returns the output destination for the logger.
func (l *Logger) Writer() io.Writer {
l.mu.Lock()
defer l.mu.Unlock()
return l.out
}

// SetOutput sets the output destination for the standard logger.
func SetOutput(w io.Writer) {
std.mu.Lock()
Expand Down

0 comments on commit 2db0c5c

Please sign in to comment.