Skip to content

Commit

Permalink
reset slogger in main after adding handler
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Pickett committed Feb 2, 2024
1 parent f089b76 commit 4ed228a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ func runLauncher(ctx context.Context, cancel func(), multiSlogger, systemMultiSl
AddSource: true,
Level: slog.LevelDebug,
}))
// need to reset slogger to include new handler
slogger = k.Slogger()
}

// create a rungroup for all the actors we create to allow for easy start/stop
Expand All @@ -221,6 +223,9 @@ func runLauncher(ctx context.Context, cancel func(), multiSlogger, systemMultiSl
logger = teelogger.New(logger, logShipper)
logger = log.With(logger, "caller", log.Caller(5))
k.AddSlogHandler(logShipper.SlogHandler())
// need to reset slogger to include new handler
slogger = k.Slogger()

ctx = ctxlog.NewContext(ctx, logger) // Set the logger back in the ctx

k.SetTraceSamplingRateOverride(1.0, initialDebugDuration)
Expand Down

0 comments on commit 4ed228a

Please sign in to comment.