mirror of
https://github.com/tgdrive/teldrive.git
synced 2024-11-14 11:45:29 +08:00
19 lines
482 B
Go
19 lines
482 B
Go
package utils
|
|
|
|
import (
|
|
"os"
|
|
|
|
"go.uber.org/zap"
|
|
"go.uber.org/zap/zapcore"
|
|
)
|
|
|
|
var Logger *zap.Logger
|
|
|
|
func InitializeLogger() {
|
|
config := zap.NewProductionEncoderConfig()
|
|
config.EncodeTime = zapcore.ISO8601TimeEncoder
|
|
consoleEncoder := zapcore.NewConsoleEncoder(config)
|
|
defaultLogLevel := zapcore.DebugLevel
|
|
core := zapcore.NewCore(consoleEncoder, zapcore.AddSync(os.Stdout), defaultLogLevel)
|
|
Logger = zap.New(core, zap.AddCaller(), zap.AddStacktrace(zapcore.ErrorLevel))
|
|
}
|