logger/glog: clean up flag getters

This commit is contained in:
Felix Lange 2016-01-27 00:50:24 +01:00
parent a411fe7e6e
commit e287b56b69

View File

@ -138,25 +138,28 @@ func SetV(v int) {
logging.verbosity.set(Level(v)) logging.verbosity.set(Level(v))
} }
// SetVmodule sets the global verbosity patterns.
func SetVmodule(pat string) error {
return logging.vmodule.Set(pat)
}
// SetToStderr sets the global output style // SetToStderr sets the global output style
func SetToStderr(toStderr bool) { func SetToStderr(toStderr bool) {
logging.mu.Lock()
logging.toStderr = toStderr logging.toStderr = toStderr
logging.mu.Unlock()
} }
// GetTraceLocation returns the global TraceLocation object // GetTraceLocation returns the global TraceLocation flag.
func GetTraceLocation() *TraceLocation { func GetTraceLocation() *TraceLocation {
return &logging.traceLocation return &logging.traceLocation
} }
// GetVModule returns the global verbosity pattern flag.
func GetVModule() *moduleSpec { func GetVModule() *moduleSpec {
return &logging.vmodule return &logging.vmodule
} }
// GetVerbosity returns the global verbosity level flag.
func GetVerbosity() *Level {
return &logging.verbosity
}
// get returns the value of the severity. // get returns the value of the severity.
func (s *severity) get() severity { func (s *severity) get() severity {
return severity(atomic.LoadInt32((*int32)(s))) return severity(atomic.LoadInt32((*int32)(s)))
@ -453,8 +456,7 @@ func init() {
// Default stderrThreshold is ERROR. // Default stderrThreshold is ERROR.
logging.stderrThreshold = errorLog logging.stderrThreshold = errorLog
logging.setVState(3, nil, false)
logging.setVState(0, nil, false)
go logging.flushDaemon() go logging.flushDaemon()
} }