4 "github.com/open-ness/EMCO/src/orchestrator/pkg/infra/config"
\r
5 log "github.com/sirupsen/logrus"
\r
9 //Fields is type that will be used by the calling function
\r
10 type Fields map[string]interface{}
\r
13 // Log as JSON instead of the default ASCII formatter.
\r
14 log.SetFormatter(&log.JSONFormatter{})
\r
15 if strings.EqualFold(config.GetConfiguration().LogLevel, "warn") {
\r
16 log.SetLevel(log.WarnLevel)
\r
19 if strings.EqualFold(config.GetConfiguration().LogLevel, "info") {
\r
20 log.SetLevel(log.InfoLevel)
\r
24 // Error uses the fields provided and logs
\r
25 func Error(msg string, fields Fields) {
\r
26 log.WithFields(log.Fields(fields)).Error(msg)
\r
29 // Warn uses the fields provided and logs
\r
30 func Warn(msg string, fields Fields) {
\r
31 log.WithFields(log.Fields(fields)).Warn(msg)
\r
34 // Info uses the fields provided and logs
\r
35 func Info(msg string, fields Fields) {
\r
36 log.WithFields(log.Fields(fields)).Info(msg)
\r