add SetLogLevelByName
This commit is contained in:
parent
ec1b3b298f
commit
edecd4a8d7
4
log.go
4
log.go
@ -94,9 +94,9 @@ func (log *Logger) SetLogLevel(newlv LogLevel) (oldlv LogLevel) {
|
|||||||
// SetLogLevelByName set new log level by level name
|
// SetLogLevelByName set new log level by level name
|
||||||
func (log *Logger) SetLogLevelByName(newlv string) (oldlv string) {
|
func (log *Logger) SetLogLevelByName(newlv string) (oldlv string) {
|
||||||
if newlevel, ok := mapStrToLevel[newlv]; ok {
|
if newlevel, ok := mapStrToLevel[newlv]; ok {
|
||||||
oldlv = log.loglevel
|
oldlevel := log.loglevel
|
||||||
log.loglevel = newlevel
|
log.loglevel = newlevel
|
||||||
return mapLevelToStr[oldlv]
|
return mapLevelToStr[oldlevel]
|
||||||
}
|
}
|
||||||
return ErrLogLevel
|
return ErrLogLevel
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user