summaryrefslogtreecommitdiff
path: root/plugins/logger/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/logger/plugin.go')
-rw-r--r--plugins/logger/plugin.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/logger/plugin.go b/plugins/logger/plugin.go
index 7fc464b6..08fc2454 100644
--- a/plugins/logger/plugin.go
+++ b/plugins/logger/plugin.go
@@ -20,11 +20,21 @@ type ZapLogger struct {
// Init logger service.
func (z *ZapLogger) Init(cfg config.Configurer) error {
const op = errors.Op("config_plugin_init")
+ var err error
+ // if not configured, configure with default params
if !cfg.Has(PluginName) {
- return errors.E(op, errors.Disabled)
+ z.cfg = &Config{}
+ z.cfg.InitDefault()
+
+ z.base, err = z.cfg.BuildLogger()
+ if err != nil {
+ return errors.E(op, errors.Disabled, err)
+ }
+
+ return nil
}
- err := cfg.UnmarshalKey(PluginName, &z.cfg)
+ err = cfg.UnmarshalKey(PluginName, &z.cfg)
if err != nil {
return errors.E(op, errors.Disabled, err)
}