From c93f12cc5b17ad69d9470d11491b2a71de38b5f4 Mon Sep 17 00:00:00 2001 From: Roald Brunell <87445607+OneFlyingBanana@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:25:57 +0200 Subject: [PATCH] Update name of AddContextToLogger --- logger/logger.go | 4 ++-- main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/logger/logger.go b/logger/logger.go index eb813ec..d6784d0 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -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": diff --git a/main.go b/main.go index c9bc433..c717d49 100644 --- a/main.go +++ b/main.go @@ -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)