Skip to content

Logger adapter for applications that use logrus as main logger and 3rd party libs that use klog

License

Notifications You must be signed in to change notification settings

tzvatot/klog-logrus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

klog-logrus

Logger adapter for applications that use logrus as main logger and 3rd party libs that use klog

Insipired by glog-logrus (https://github.com/kubermatic/glog-logrus).

Usage

In go.mod, use a replace entry for klog:

replace (
  k8s.io/klog => github.com/tzvatot/klog-logrus v1.0.0
)

When creating the logrus logger, have the following imports:

import (
	"k8s.io/klog"
	"github.com/sirupsen/logrus"
)

And set it to klog:

defaultLogger := logrus.StandardLogger()
klog.SetLogger(defaultLogger)

About

Logger adapter for applications that use logrus as main logger and 3rd party libs that use klog

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages