diff options
Diffstat (limited to 'src/k8splugin/internal/logutils/logger.go')
-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) +} + |