Commit 51104cd4 authored by Andrew Poydence's avatar Andrew Poydence Committed by Rob Pike

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: 2db0c5c7416436f99852592d2f258ca93da96712
GitHub-Pull-Request: golang/go#28399
Reviewed-on: https://go-review.googlesource.com/c/144757Reviewed-by: default avatarRob Pike <r@golang.org>
parent 7a634034
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment