github.com/weedge/lib@v0.0.0-20230424045628-a36dcc1d90e4/log/biz_log.go (about) 1 package log 2 3 import ( 4 "go.uber.org/zap" 5 ) 6 7 type bizLog struct { 8 logger *zap.SugaredLogger 9 } 10 11 func newBizLogger(config LoggerConfig, rotateByHour bool) (*bizLog, error) { 12 logger, err := createZapLogger(config, rotateByHour) 13 if err != nil { 14 return nil, err 15 } 16 return &bizLog{ 17 logger: logger.Sugar(), 18 }, nil 19 } 20 21 func (l *bizLog) Sync() { 22 _ = l.logger.Sync() 23 } 24 25 func (l *bizLog) Info(args ...interface{}) { 26 l.logger.Info(args...) 27 } 28 func (l *bizLog) Debug(args ...interface{}) { 29 l.logger.Debug(args...) 30 } 31 func (l *bizLog) Warn(args ...interface{}) { 32 l.logger.Warn(args...) 33 } 34 func (l *bizLog) Error(args ...interface{}) { 35 l.logger.Error(args...) 36 } 37 func (l *bizLog) Infof(format string, args ...interface{}) { 38 l.logger.Infof(format, args...) 39 } 40 func (l *bizLog) Debugf(format string, args ...interface{}) { 41 l.logger.Debugf(format, args...) 42 } 43 func (l *bizLog) Warnf(format string, args ...interface{}) { 44 l.logger.Warnf(format, args...) 45 } 46 func (l *bizLog) Errorf(format string, args ...interface{}) { 47 l.logger.Errorf(format, args...) 48 }