From acddbe2e281ebf80d31e7a03646ccfa0a9d6b25b Mon Sep 17 00:00:00 2001 From: sanjaymekhale Date: Fri, 25 Oct 2019 06:45:06 +0000 Subject: Implementing suggested changes Renamed package from logs to logutils Issue-ID: MULTICLOUD-577 Change-Id: I05e2acbfbb5dd79bd26df73e0ad64c2068b9f6e5 Signed-off-by: sanjaymekhale --- src/k8splugin/internal/logutils/logger.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/k8splugin/internal/logutils/logger.go (limited to 'src/k8splugin/internal') diff --git a/src/k8splugin/internal/logutils/logger.go b/src/k8splugin/internal/logutils/logger.go new file mode 100644 index 00000000..7df23474 --- /dev/null +++ b/src/k8splugin/internal/logutils/logger.go @@ -0,0 +1,15 @@ +package logutils + +import ( + log "github.com/sirupsen/logrus" +) + +func init() { + // Log as JSON instead of the default ASCII formatter. + log.SetFormatter(&log.JSONFormatter{}) +} + +func WithFields(msg string, fkey string, fvalue string) { + log.WithFields(log.Fields{fkey: fvalue}).Error(msg) +} + -- cgit 1.2.3-korg