feat: implement logger
This commit is contained in:
@@ -28,6 +28,7 @@ type Config struct {
|
||||
Cors CorsConfig
|
||||
MeiliSearch MeiliSearchConfig
|
||||
Storage StorageConfig
|
||||
Log LogConfig
|
||||
}
|
||||
|
||||
type I18n struct {
|
||||
@@ -87,6 +88,11 @@ type AppConfig struct {
|
||||
BaseURL string `env:"APP_BASE_URL,http://localhost:5173"`
|
||||
}
|
||||
|
||||
type LogConfig struct {
|
||||
LogLevel string `env:"LOG_LEVEL,warn"`
|
||||
LogColorize bool `env:"LOG_COLORIZE,true"`
|
||||
}
|
||||
|
||||
type EmailConfig struct {
|
||||
SMTPHost string `env:"EMAIL_SMTP_HOST,localhost"`
|
||||
SMTPPort int `env:"EMAIL_SMTP_PORT,587"`
|
||||
@@ -209,6 +215,11 @@ func load() *Config {
|
||||
if err != nil {
|
||||
slog.Error("not possible to load env variables for storage : ", err.Error(), "")
|
||||
}
|
||||
|
||||
err = loadEnv(&cfg.Log)
|
||||
if err != nil {
|
||||
slog.Error("not possible to load env variables for logger : ", err.Error(), "")
|
||||
}
|
||||
cfg.Storage.RootFolder = ResolveRelativePath(cfg.Storage.RootFolder)
|
||||
|
||||
return cfg
|
||||
|
||||
Reference in New Issue
Block a user