diff options
author | Valery Piashchynski <[email protected]> | 2021-01-21 13:25:36 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-01-21 13:25:36 +0300 |
commit | 7da6c78449776e1f3c6716250bca0b712a0423a4 (patch) | |
tree | f3512de66aca2bba408485a0ea2fc936c0e4fb9b /plugins/logger | |
parent | 0ff05b2732b4fd0783f959c94c54d7e39169f979 (diff) |
Uniform all configs
Add debug server
Check nil's for all plugin intialization
Diffstat (limited to 'plugins/logger')
-rw-r--r-- | plugins/logger/plugin.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/logger/plugin.go b/plugins/logger/plugin.go index 250127b0..719770c0 100644 --- a/plugins/logger/plugin.go +++ b/plugins/logger/plugin.go @@ -13,13 +13,17 @@ const PluginName = "logs" // ZapLogger manages zap logger. type ZapLogger struct { base *zap.Logger - cfg Config + cfg *Config channels ChannelConfig } // Init logger service. func (z *ZapLogger) Init(cfg config.Configurer) error { - const op = errors.Op("zap logger init") + const op = errors.Op("config_plugin_init") + if !cfg.Has(PluginName) { + return errors.E(op, errors.Disabled) + } + err := cfg.UnmarshalKey(PluginName, &z.cfg) if err != nil { return errors.E(op, errors.Disabled, err) |