in logging/facility.go [112:144]
func (f *Facility) Log(logName string, wantLevel Level, fields bark.Fields, msg []interface{}) {
f.mu.RLock()
defer f.mu.RUnlock()
if setLevel, ok := f.levels[logName]; ok {
// For me this is confusing, so here's a clarification.
// The levels are consecutive integers starting from 0 defined in this order:
// Panic=0, Fatal=1, Error=2, Warning=3, etc...
// For the condition to make more sense, consider a named
// logger set to Fatal and an incoming Error message.
if setLevel < wantLevel {
return
}
}
logger := f.logger
// If there are any fields, apply them.
if len(fields) > 0 {
logger = logger.WithFields(fields)
}
switch wantLevel {
case Debug:
logger.Debug(msg...)
case Info:
logger.Info(msg...)
case Warn:
logger.Warn(msg...)
case Error:
logger.Error(msg...)
case Fatal:
logger.Fatal(msg...)
case Panic:
logger.Panic(msg...)
}
}