mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 11:39:46 +08:00
init
This commit is contained in:
55
log/log.go
Normal file
55
log/log.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
var sugar *zap.SugaredLogger
|
||||
|
||||
func init() {
|
||||
config := zap.NewDevelopmentConfig()
|
||||
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
||||
config.DisableStacktrace = true
|
||||
logger, _ := config.Build(zap.AddCallerSkip(1))
|
||||
sugar = logger.Sugar()
|
||||
}
|
||||
|
||||
func Info(args ...interface{}) {
|
||||
sugar.Info(args...)
|
||||
}
|
||||
|
||||
func Debug(args ...interface{}) {
|
||||
sugar.Debug(args...)
|
||||
}
|
||||
|
||||
func Warn(args ...interface{}) {
|
||||
sugar.Warn(args...)
|
||||
}
|
||||
|
||||
func Error(args ...interface{}) {
|
||||
sugar.Error(args...)
|
||||
}
|
||||
|
||||
func Panic(args ...interface{}) {
|
||||
sugar.Panic(args...)
|
||||
}
|
||||
|
||||
func Infof(template string, args ...interface{}) {
|
||||
sugar.Infof(template, args...)
|
||||
}
|
||||
|
||||
func Debugf(template string, args ...interface{}) {
|
||||
sugar.Debugf(template, args...)
|
||||
}
|
||||
|
||||
func Warnf(template string, args ...interface{}) {
|
||||
sugar.Warnf(template, args...)
|
||||
}
|
||||
func Errorf(template string, args ...interface{}) {
|
||||
sugar.Errorf(template, args...)
|
||||
}
|
||||
|
||||
func Panicf(template string, args ...interface{}) {
|
||||
sugar.Panicf(template, args...)
|
||||
}
|
||||
Reference in New Issue
Block a user