From 9db7db54b0e84d6b3ace94cb1f2a42e065575f17 Mon Sep 17 00:00:00 2001 From: Colin Arnott Date: Thu, 22 Oct 2020 22:16:01 +0000 Subject: log: expose std via new Default function To allow passing around the package level *Logger, it is now exposed to callers of the Default function. We considered exposing std, however at this time there is no need to allow callers to replace std only pass and call methods directly. Fixes #39057 Change-Id: I710b16a3aa5e4e878870561dbf59560f98d8d09a Reviewed-on: https://go-review.googlesource.com/c/go/+/264460 Run-TryBot: Ian Lance Taylor TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Trust: Alberto Donizetti --- src/log/log.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/log/log.go') diff --git a/src/log/log.go b/src/log/log.go index 216cfe0322..8c0f83f0d1 100644 --- a/src/log/log.go +++ b/src/log/log.go @@ -75,6 +75,9 @@ func (l *Logger) SetOutput(w io.Writer) { var std = New(os.Stderr, "", LstdFlags) +// Default returns the *Logger used by the package-level output functions. +func Default() *Logger { return std } + // Cheap integer to fixed-width decimal ASCII. Give a negative width to avoid zero-padding. func itoa(buf *[]byte, i int, wid int) { // Assemble decimal in reverse order. -- cgit v1.3 From 926994fd7cf65b2703552686965fb05569699897 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Thu, 26 Nov 2020 17:01:35 +0100 Subject: log: make Default doc comment consistent with package doc None of the other, older, doc comments use the '*Logger' form, and while 'Logger' and 'logger' are both used in the package doc comment, the common term used with the intended meaning is 'standard logger', which appears another eleven times in doc comments. Change-Id: I089103198fc82390517615eb27bbe7ef77107d34 Reviewed-on: https://go-review.googlesource.com/c/go/+/273486 Reviewed-by: Rob Pike Reviewed-by: Ian Lance Taylor Trust: Ian Lance Taylor --- src/log/log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/log/log.go') diff --git a/src/log/log.go b/src/log/log.go index 8c0f83f0d1..b77af29032 100644 --- a/src/log/log.go +++ b/src/log/log.go @@ -75,7 +75,7 @@ func (l *Logger) SetOutput(w io.Writer) { var std = New(os.Stderr, "", LstdFlags) -// Default returns the *Logger used by the package-level output functions. +// Default returns the standard logger used by the package-level output functions. func Default() *Logger { return std } // Cheap integer to fixed-width decimal ASCII. Give a negative width to avoid zero-padding. -- cgit v1.3