summaryrefslogtreecommitdiff
path: root/plugins/logger
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-02-02 19:30:00 +0300
committerGitHub <[email protected]>2021-02-02 19:30:00 +0300
commit20a1a5d2eb26090e0eef0e6772330ee2a52526fa (patch)
treec282e18c20029f60a798576cb4fe47d2762ffba0 /plugins/logger
parent36f01dc035f42115fcfd3b77dc5df3098382cd9f (diff)
parent2bdf7fafa73cabf7cf63657a6b58f2a423ae0fcd (diff)
Merge pull request #522 from spiral/fix/named_loggerv2.0.0-beta.22
bug(logger): Incorrect parsing of nested log levels
Diffstat (limited to 'plugins/logger')
-rw-r--r--plugins/logger/config.go12
-rw-r--r--plugins/logger/plugin.go2
2 files changed, 7 insertions, 7 deletions
diff --git a/plugins/logger/config.go b/plugins/logger/config.go
index 8cc88d02..bf7343c7 100644
--- a/plugins/logger/config.go
+++ b/plugins/logger/config.go
@@ -10,26 +10,26 @@ import (
// ChannelConfig configures loggers per channel.
type ChannelConfig struct {
// Dedicated channels per logger. By default logger allocated via named logger.
- Channels map[string]Config `json:"channels" mapstructure:"channels"`
+ Channels map[string]Config `mapstructure:"channels"`
}
type Config struct {
// Mode configures logger based on some default template (development, production, off).
- Mode string `json:"mode" mapstructure:"mode"`
+ Mode string `mapstructure:"mode"`
// Level is the minimum enabled logging level. Note that this is a dynamic
// level, so calling ChannelConfig.Level.SetLevel will atomically change the log
// level of all loggers descended from this config.
- Level string `json:"level" mapstructure:"level"`
+ Level string `mapstructure:"level"`
// Encoding sets the logger's encoding. Valid values are "json" and
// "console", as well as any third-party encodings registered via
// RegisterEncoder.
- Encoding string `json:"encoding" mapstructure:"encoding"`
+ Encoding string `mapstructure:"encoding"`
// Output is a list of URLs or file paths to write logging output to.
// See Open for details.
- Output []string `json:"output" mapstructure:"output"`
+ Output []string `mapstructure:"output"`
// ErrorOutput is a list of URLs to write internal logger errors to.
// The default is standard error.
@@ -37,7 +37,7 @@ type Config struct {
// Note that this setting only affects internal errors; for sample code that
// sends error-level logs to a different location from info- and debug-level
// logs, see the package-level AdvancedConfiguration example.
- ErrorOutput []string `json:"errorOutput" mapstructure:"errorOutput"`
+ ErrorOutput []string `mapstructure:"errorOutput"`
}
// ZapConfig converts config into Zap configuration.
diff --git a/plugins/logger/plugin.go b/plugins/logger/plugin.go
index 141ede64..7fc464b6 100644
--- a/plugins/logger/plugin.go
+++ b/plugins/logger/plugin.go
@@ -53,7 +53,7 @@ func (z *ZapLogger) NamedLogger(name string) (Logger, error) {
if err != nil {
return nil, err
}
- return NewZapAdapter(l), nil
+ return NewZapAdapter(l.Named(name)), nil
}
return NewZapAdapter(z.base.Named(name)), nil