mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-01-11 01:28:27 +08:00
20 lines
482 B
Go
20 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))
|
||
|
}
|