Skip to content

Commit

Permalink
Update name of AddContextToLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
OneFlyingBanana committed Jul 2, 2024
1 parent fe4de0f commit c93f12c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type contextKey string
const loggerKey contextKey = "logger"
const errorLoggerKey contextKey = "errorLogger"

// NewContextWithLogger creates a new context with a zerolog logger for stdout adn stderr and sets the global log level.
func NewContextWithLogger(ctx context.Context, logLevel string) context.Context {
// AddLoggerToContext creates a new context with a zerolog logger for stdout adn stderr and sets the global log level.
func AddLoggerToContext(ctx context.Context, logLevel string) context.Context {
// Set log level to configured value
switch logLevel {
case "debug":
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func run() error {
g, ctx := errgroup.WithContext(ctx)

logLevel := viper.GetString("log_level")
ctx = logger.NewContextWithLogger(ctx, logLevel)
ctx = logger.AddLoggerToContext(ctx, logLevel)

log := logger.FromContext(ctx)
errLog := logger.ErrorLoggerFromContext(ctx)
Expand Down

0 comments on commit c93f12c

Please sign in to comment.