Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: common/logging/config.go

Issue 1622553005: Remove log filtering and add stringsetflag. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: error on empty Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/logging/cloudlog/logging.go ('k') | common/logging/exported.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/logging/config.go
diff --git a/common/logging/config.go b/common/logging/config.go
index 2e07fc6f50d7453b5e4ed213522a0e4b7871e34b..bd62e783f5c2ab88a98fb801e1d7fe0841f8160c 100644
--- a/common/logging/config.go
+++ b/common/logging/config.go
@@ -12,31 +12,17 @@ import (
// Config is a logging configuration structure.
type Config struct {
- Level Level
- Filter Filter
+ Level Level
}
// AddFlags adds common flags to a supplied FlagSet.
func (c *Config) AddFlags(fs *flag.FlagSet) {
- fs.Var(&c.Level, "log_level",
+ fs.Var(&c.Level, "log-level",
"The logging level. Valid options are: debug, info, warning, error.")
- fs.Var(&c.Filter, "log_filter",
- "Log filter keywords. Can be specified multiple times.")
}
-// Set installs a filter-aware logger that wraps the currently-installed Logger
-// and selectively discards messages based on the logging configuration.
+// Set installs a logger that wraps the currently-installed Logger and sets
+// the level via the command-line level flag.
func (c *Config) Set(ctx context.Context) context.Context {
- filterFunc := c.Filter.Get()
- baseFactory := GetFactory(ctx)
-
- ctx = SetLevel(ctx, c.Level)
- return SetFactory(ctx, func(ctx context.Context) Logger {
- if value, ok := GetFields(ctx)[FilterOnKey]; ok {
- if !filterFunc(value) {
- return Null()
- }
- }
- return baseFactory(ctx)
- })
+ return SetLevel(ctx, c.Level)
}
« no previous file with comments | « common/logging/cloudlog/logging.go ('k') | common/logging/exported.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698