Skip to content

Commit

Permalink
fix: use slog after logger init
Browse files Browse the repository at this point in the history
  • Loading branch information
tolgaOzen committed Jul 23, 2024
1 parent 07f2278 commit 97ce5eb
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions pkg/cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,6 @@ func serve() func(cmd *cobra.Command, args []string) error {
defer stop()

internal.Identifier = cfg.AccountID
if internal.Identifier == "" {
message := "Account ID is not set. Please fill in the Account ID for better support. Get your Account ID from https://permify.co/account"
slog.Error(message)

ticker := time.NewTicker(24 * time.Hour)
defer ticker.Stop()

go func() {
for range ticker.C {
slog.Error(message)
}
}()
}

var logger *slog.Logger

Expand Down Expand Up @@ -252,6 +239,20 @@ func serve() func(cmd *cobra.Command, args []string) error {
slog.SetDefault(logger)
}

if internal.Identifier == "" {
message := "Account ID is not set. Please fill in the Account ID for better support. Get your Account ID from https://permify.co/account"
slog.Error(message)

ticker := time.NewTicker(24 * time.Hour)
defer ticker.Stop()

go func() {
for range ticker.C {
slog.Error(message)
}
}()
}

slog.Info("🚀 starting permify service...")

// Run database migration if enabled
Expand Down

0 comments on commit 97ce5eb

Please sign in to comment.