1
0
mirror of https://github.com/golang/go synced 2024-11-26 21:11:57 -07:00

log: add Logger.Writer method

Writer method returns the underlying io.Writer used by the given Logger
object.

Fixes #28327

Change-Id: I6347913d8be8d3222b98967b136cf03d00f446d1
GitHub-Last-Rev: 2db0c5c741
GitHub-Pull-Request: golang/go#28399
Reviewed-on: https://go-review.googlesource.com/c/144757
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Andrew Poydence 2018-10-25 23:14:15 +00:00 committed by Rob Pike
parent 7a634034c8
commit 51104cd4d2

View File

@ -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()