feat: implement logger

This commit is contained in:
2026-04-15 14:59:35 +02:00
parent 7bce04e05a
commit 9961d90fa7
22 changed files with 622 additions and 17 deletions

View File

@@ -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