added a bit of zap logging
Some checks failed
Build and Push Docker Image / Build image (push) Failing after 58s

This commit is contained in:
2025-04-09 20:03:34 +03:00
parent 29d13371a8
commit 54174ef418
8 changed files with 58 additions and 14 deletions

26
logger/logger.go Normal file
View File

@@ -0,0 +1,26 @@
package logger
import (
"os"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var Logger *zap.Logger
func init() {
var cfg zap.Config
if os.Getenv("DEBUG") == "true" {
cfg = zap.NewDevelopmentConfig()
} else {
cfg = zap.NewProductionConfig()
}
cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
var err error
Logger, err = cfg.Build()
if err != nil {
panic(err)
}
defer Logger.Sync() // flushes buffer, if any
}