feat: add LOG_LEVEL to envs

This commit is contained in:
Mohamad Khani 2025-03-12 23:33:09 +03:30
parent 4d6b06efe7
commit f2b627cee2

View File

@ -2,6 +2,8 @@ package pkg
import ( import (
"context" "context"
"os"
"strconv"
"github.com/mattn/go-colorable" "github.com/mattn/go-colorable"
"go.uber.org/zap" "go.uber.org/zap"
@ -82,8 +84,10 @@ func OverrideLoggerConfig(config LoggerConfig) {
Logger = createOrUpdateInstance(config) Logger = createOrUpdateInstance(config)
} }
var level, err = strconv.Atoi(os.Getenv("LOG_LEVEL"))
var Logger = GetLogger(context.Background(), LoggerConfig{ var Logger = GetLogger(context.Background(), LoggerConfig{
Level: zap.DebugLevel, Level: zapcore.Level(level),
Filename: "./tmp/error.log", Filename: "./tmp/error.log",
MaxSize: 100, MaxSize: 100,
MaxAge: 90, MaxAge: 90,