don't set logger default level twice (#1336)

This commit is contained in:
mmetc 2022-03-10 13:56:46 +01:00 committed by GitHub
parent aca37a38e7
commit e7de05d6c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 12 deletions

View file

@ -19,7 +19,7 @@ import (
var logger hclog.Logger = hclog.New(&hclog.LoggerOptions{
Name: "splunk-plugin",
Level: hclog.LevelFromString("DEBUG"),
Level: hclog.LevelFromString("INFO"),
Output: os.Stderr,
JSONFormat: true,
})
@ -45,11 +45,11 @@ func (s *Splunk) Notify(ctx context.Context, notification *protobufs.Notificatio
return &protobufs.Empty{}, fmt.Errorf("splunk invalid config name %s", notification.Name)
}
cfg := s.PluginConfigByName[notification.Name]
if cfg.LogLevel != nil && *cfg.LogLevel != "" {
logger.SetLevel(hclog.LevelFromString(*cfg.LogLevel))
} else {
logger.SetLevel(hclog.Info)
}
logger.Info(fmt.Sprintf("received notify signal for %s config", notification.Name))
p := Payload{Event: notification.Text}