diff options
author | sanjaymekhale <sm00557598@techmahindra.com> | 2019-10-25 06:45:06 +0000 |
---|---|---|
committer | sanjaymekhale <sm00557598@techmahindra.com> | 2019-10-25 06:45:06 +0000 |
commit | acddbe2e281ebf80d31e7a03646ccfa0a9d6b25b (patch) | |
tree | ee28b01ae0e854f9c753e9b1633e1893edc0f903 /src/k8splugin/internal | |
parent | b0f94ada2751713ea8d62c235d0bc1cc2877034a (diff) |
Implementing suggested changes
Renamed package from logs to logutils
Issue-ID: MULTICLOUD-577
Change-Id: I05e2acbfbb5dd79bd26df73e0ad64c2068b9f6e5
Signed-off-by: sanjaymekhale <sm00557598@techmahindra.com>
Diffstat (limited to 'src/k8splugin/internal')
-rw-r--r-- | src/k8splugin/internal/logutils/logger.go | 15 |
1 files changed, 15 insertions, 0 deletions
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) +} + |