summaryrefslogtreecommitdiff
path: root/plugins/logger/plugin.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-21 16:32:36 +0300
committerGitHub <[email protected]>2021-01-21 16:32:36 +0300
commit300e8367858f5288b2ce6addbf254a100e5c206a (patch)
tree7c9a6744fa9ce130d80c634da3d7596f70fda51a /plugins/logger/plugin.go
parent0ff05b2732b4fd0783f959c94c54d7e39169f979 (diff)
parent8029e2d1107e4663f1104ebf25c40f252c8ea111 (diff)
Merge pull request #491 from spiral/refactor/add_debug_server
ref(configs, debug): update configs, add debug server
Diffstat (limited to 'plugins/logger/plugin.go')
-rw-r--r--plugins/logger/plugin.go8
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)