Skip to content

Commit

Permalink
chore: remove unnecessary level filter (#6392)
Browse files Browse the repository at this point in the history
* chore: remove unnecessary level filter

Signed-off-by: Ben Ye <[email protected]>

* remove unused code

Signed-off-by: Ben Ye <[email protected]>

---------

Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 authored Dec 3, 2024
1 parent bc1b5be commit 8751c97
Showing 1 changed file with 1 addition and 19 deletions.
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

0 comments on commit 8751c97

Please sign in to comment.