AFAIRE
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
867 B

/*
------------------------------------------------------------------------------------------------------------------------
####### logger ####### Copyright (c) 2021-2022 losyme ############################################## MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package logger
import "log"
type adapter struct {
level Level
logger *Logger
}
func (a *adapter) Write(p []byte) (int, error) {
a.logger.Log(a.level, string(p))
return len(p), nil
}
func (l *Logger) NewStdLogger(level, prefix string, flag int) *log.Logger {
a := &adapter{
level: StringToLevel(level),
logger: l,
}
return log.New(a, prefix, flag)
}
/*
######################################################################################################## @(°_°)@ #######
*/