mirror of https://github.com/grpc/grpc-go.git
Comment: explain concurrent access to grpclog.logger
grpc's pluggable logger is not mutex-protected: added comments that it should be changed only in init() functions.
This commit is contained in:
parent
93591e7568
commit
65e7361599
|
@ -42,6 +42,8 @@ import (
|
|||
)
|
||||
|
||||
// Use golang's standard logger by default.
|
||||
// Access is not mutex-protected: do not modify except in init()
|
||||
// functions.
|
||||
var logger Logger = log.New(os.Stderr, "", log.LstdFlags)
|
||||
|
||||
// Logger mimics golang's standard Logger as an interface.
|
||||
|
@ -54,7 +56,8 @@ type Logger interface {
|
|||
Println(args ...interface{})
|
||||
}
|
||||
|
||||
// SetLogger sets the logger that is used in grpc.
|
||||
// SetLogger sets the logger that is used in grpc. Call only from
|
||||
// init() functions.
|
||||
func SetLogger(l Logger) {
|
||||
logger = l
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue