Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unnecessary level filter #6392

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions pkg/util/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func newPrometheusLoggerFrom(logger log.Logger, logLevel logging.Level, keyvals
// Ref: https://github.com/go-kit/log/issues/14#issuecomment-945038252
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
logger = log.With(logger, keyvals...)
logger = level.NewFilter(logger, LevelFilter(logLevel.String()))
logger = level.NewFilter(logger, logLevel.Gokit)

// Initialise counters for all supported levels:
for _, level := range supportedLevels {
Expand Down Expand Up @@ -123,24 +123,6 @@ func CheckFatal(location string, err error) {
}
}

// TODO(dannyk): remove once weaveworks/common updates to go-kit/log
//
// -> we can then revert to using Level.Gokit
func LevelFilter(l string) level.Option {
switch l {
case "debug":
return level.AllowDebug()
case "info":
return level.AllowInfo()
case "warn":
return level.AllowWarn()
case "error":
return level.AllowError()
default:
return level.AllowAll()
}
}

func HeaderMapFromContext(ctx context.Context) map[string]string {
headerMap, ok := ctx.Value(headerMapContextKey).(map[string]string)
if !ok {
Expand Down
Loading