Feat add SetLogMode
This commit is contained in:
parent
231effe119
commit
758fbcd5fd
@ -49,6 +49,7 @@ type Config struct {
|
||||
// Interface logger interface
|
||||
type Interface interface {
|
||||
LogMode(LogLevel) Interface
|
||||
SetLogMode(LogLevel) Interface
|
||||
Info(context.Context, string, ...interface{})
|
||||
Warn(context.Context, string, ...interface{})
|
||||
Error(context.Context, string, ...interface{})
|
||||
@ -109,6 +110,12 @@ func (l *logger) LogMode(level LogLevel) Interface {
|
||||
return &newlogger
|
||||
}
|
||||
|
||||
// SetLogMode global log mode
|
||||
func (l *logger) SetLogMode(level LogLevel) Interface {
|
||||
l.LogLevel = level
|
||||
return l
|
||||
}
|
||||
|
||||
// Info print info
|
||||
func (l logger) Info(ctx context.Context, msg string, data ...interface{}) {
|
||||
if l.LogLevel >= Info {
|
||||
|
Loading…
x
Reference in New Issue
Block a user