1
0
mirror of https://github.com/golang/go synced 2024-11-12 09:20:22 -07:00

log: add Writer method to Logger

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

Fixes #28327
This commit is contained in:
Andrew Poydence 2018-10-25 16:20:09 -06:00 committed by Andrew Poydence
parent 9627180f0f
commit 2db0c5c741

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