more progress

This commit is contained in:
2022-04-28 19:24:21 -04:00
parent 9491c83f50
commit 715f25ec5c
11 changed files with 264 additions and 29 deletions

1
log/exp.go Normal file
View File

@ -0,0 +1 @@
package log

35
log/log.go Normal file
View File

@ -0,0 +1,35 @@
package log
import (
"go.uber.org/zap"
)
var Logger *zap.SugaredLogger
var Debug, Info, Warn, Error, Panic func(msg string, keysAndValues ...interface{})
func init() {
cfg := zap.NewProductionConfig()
devCfg := zap.NewDevelopmentConfig()
// Readable time stamp
cfg.EncoderConfig.EncodeTime = devCfg.EncoderConfig.EncodeTime
// Uncomment to enable debug logging
// cfg.Level = devCfg.Level
logger, err := cfg.Build()
if err != nil {
println("unable to intialize zap log")
panic(err)
}
Logger = logger.Sugar()
Debug = Logger.Debugw
Info = Logger.Infow
Warn = Logger.Warnw
Error = Logger.Errorw
Panic = Logger.Panicw
}