Add support for JSON logging

This commit is contained in:
Jan Dittberner 2023-07-29 17:58:09 +02:00
parent 43f32731f6
commit c6177c4d18
2 changed files with 6 additions and 0 deletions

View file

@ -72,6 +72,10 @@ func main() {
logger.SetLevel(logLevel) logger.SetLevel(logLevel)
} }
if config.Bool("log.json") {
logger.SetFormatter(&log.JSONFormatter{})
}
bundle, catalog := services.InitI18n(logger, config.Strings("i18n.languages")) bundle, catalog := services.InitI18n(logger, config.Strings("i18n.languages"))
services.AddMessages(catalog) services.AddMessages(catalog)

View file

@ -43,6 +43,8 @@ var DefaultConfiguration = map[string]interface{}{
"oidc.server": "https://auth.cacert.localhost:4444/", "oidc.server": "https://auth.cacert.localhost:4444/",
"session.path": "sessions/app", "session.path": "sessions/app",
"i18n.languages": []string{"en", "de"}, "i18n.languages": []string{"en", "de"},
"log.level": "info",
"log.json": true,
} }
func ConfigureApplication( func ConfigureApplication(