diff options
Diffstat (limited to 'src/orchestrator/pkg/infra/logutils/logger.go')
-rw-r--r-- | src/orchestrator/pkg/infra/logutils/logger.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/orchestrator/pkg/infra/logutils/logger.go b/src/orchestrator/pkg/infra/logutils/logger.go index 2e8f9969..209114a3 100644 --- a/src/orchestrator/pkg/infra/logutils/logger.go +++ b/src/orchestrator/pkg/infra/logutils/logger.go @@ -2,6 +2,9 @@ package logutils import ( log "github.com/sirupsen/logrus" + "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/config" + "strings" + ) //Fields is type that will be used by the calling function @@ -10,6 +13,13 @@ type Fields map[string]interface{} func init() { // Log as JSON instead of the default ASCII formatter. log.SetFormatter(&log.JSONFormatter{}) + if strings.EqualFold(config.GetConfiguration().LogLevel, "warn") { + log.SetLevel(log.WarnLevel) + + } + if strings.EqualFold(config.GetConfiguration().LogLevel, "info") { + log.SetLevel(log.InfoLevel) + } } // Error uses the fields provided and logs @@ -26,3 +36,4 @@ func Warn(msg string, fields Fields) { func Info(msg string, fields Fields) { log.WithFields(log.Fields(fields)).Info(msg) } + |