set default slog

This commit is contained in:
Elio Bischof 2024-11-29 01:00:01 +01:00
parent 3261105fdd
commit 1ce51a5212
No known key found for this signature in database
GPG Key ID: 7B383FDE4DDBF1BD
7 changed files with 21 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package initialise
import (
"log/slog"
"github.com/mitchellh/mapstructure"
"github.com/spf13/viper"
"github.com/zitadel/logging"
@ -28,6 +30,8 @@ func MustNewConfig(v *viper.Viper) *Config {
err = config.Log.SetLogger()
logging.OnError(err).Fatal("unable to set logger")
slog.SetDefault(config.Log.Slog())
id.Configure(config.Machine)
return config

View File

@ -2,6 +2,7 @@ package mirror
import (
_ "embed"
"log/slog"
"time"
"github.com/mitchellh/mapstructure"
@ -40,6 +41,8 @@ func mustNewMigrationConfig(v *viper.Viper) *Migration {
err := config.Log.SetLogger()
logging.OnError(err).Fatal("unable to set logger")
slog.SetDefault(config.Log.Slog())
id.Configure(config.Machine)
return config
@ -52,6 +55,8 @@ func mustNewProjectionsConfig(v *viper.Viper) *ProjectionsConfig {
err := config.Log.SetLogger()
logging.OnError(err).Fatal("unable to set logger")
slog.SetDefault(config.Log.Slog())
id.Configure(config.Machine)
return config

View File

@ -1,6 +1,7 @@
package ready
import (
"log/slog"
"time"
"github.com/mitchellh/mapstructure"
@ -35,5 +36,7 @@ func MustNewConfig(v *viper.Viper) *Config {
err = config.Log.SetLogger()
logging.OnError(err).Fatal("unable to set logger")
slog.SetDefault(config.Log.Slog())
return config
}

View File

@ -2,6 +2,7 @@ package setup
import (
"bytes"
"log/slog"
"strings"
"time"
@ -85,6 +86,8 @@ func MustNewConfig(v *viper.Viper) *Config {
err = config.Log.SetLogger()
logging.OnError(err).Fatal("unable to set logger")
slog.SetDefault(config.Log.Slog())
id.Configure(config.Machine)
return config

2
go.mod
View File

@ -64,7 +64,7 @@ require (
github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203
github.com/ttacon/libphonenumber v1.2.1
github.com/twilio/twilio-go v1.22.2
github.com/zitadel/logging v0.6.2-0.20241128222642-711905ab995b
github.com/zitadel/logging v0.6.2-0.20241128235432-e4276c762137
github.com/zitadel/oidc/v3 v3.32.0
github.com/zitadel/passwap v0.6.0
github.com/zitadel/saml v0.2.0

1
go.sum
View File

@ -739,6 +739,7 @@ github.com/zenazn/goji v1.0.1 h1:4lbD8Mx2h7IvloP7r2C0D6ltZP6Ufip8Hn0wmSK5LR8=
github.com/zenazn/goji v1.0.1/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
github.com/zitadel/logging v0.6.2-0.20241128222642-711905ab995b h1:CWfvy15tGabH4CE2PpYjOkykzNBKPbS7pEl0sH0l6pY=
github.com/zitadel/logging v0.6.2-0.20241128222642-711905ab995b/go.mod h1:DyabloyDEDPGVRXGHKzWuX8wBBs7w4qo6WyTC5Xs7UQ=
github.com/zitadel/logging v0.6.2-0.20241128235432-e4276c762137/go.mod h1:DyabloyDEDPGVRXGHKzWuX8wBBs7w4qo6WyTC5Xs7UQ=
github.com/zitadel/oidc/v3 v3.32.0 h1:Mw0EPZRC6h+OXAuT0Uk2BZIjJQNHLqUpaJCm6c3IByc=
github.com/zitadel/oidc/v3 v3.32.0/go.mod h1:DyE/XClysRK/ozFaZSqlYamKVnTh4l6Ln25ihSNI03w=
github.com/zitadel/passwap v0.6.0 h1:m9F3epFC0VkBXu25rihSLGyHvWiNlCzU5kk8RoI+SXQ=

View File

@ -3,6 +3,7 @@ package integration
import (
"bytes"
_ "embed"
"log/slog"
"os/exec"
"path/filepath"
@ -49,5 +50,8 @@ func init() {
if err := loadedConfig.Log.SetLogger(); err != nil {
panic(err)
}
slog.SetDefault(loadedConfig.Log.Slog())
SystemToken = systemUserToken()
}