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:
parent
9627180f0f
commit
2db0c5c741
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user