Categorygithub.com/kubermatic/glog-logrus
modulepackage
0.0.0-20180829085450-3fa5b9870d1d
Repository: https://github.com/kubermatic/glog-logrus.git
Documentation: pkg.go.dev

# README

glog-logrus

This packages is a replacement for glog in projects that use the logrus.

It is inspired by istio's glog package for zap: https://github.com/istio/glog

Usage

Override the official glog package with this one. This simply replaces the code in vendor/golang/glog with the code of this package.

In your Gopkg.toml:

[[override]]
  name = "github.com/golang/glog"
  source = "github.com/kubermatic/glog-logrus"

In your main.go:

// Import the package like it is original glog
import (
  "github.com/golang/glog"
  "github.com/sirupsen/logrus"
)

// Create logrus logger in your main.go
logger := logrus.New()
logger.Formatter = &logrus.JSONFormatter{DisableTimestamp: true}

// Overriding the default glog with our logrus glog implementation.
// Thus we need to pass it our logrus logger object.
glog.SetLogger(logger.WithField("foo", "bar"))

Setting the logger to the glog package MUST happen before using glog in any package.

The functionality of logging the filename and line number is not preserved at this time.

Function Levels

gloglogrus
InfoDebug
InfoDepthDebug
InfofDebug
InfolnDebug
WarningWarn
WarningDepthWarn
WarningfWarn
WarninglnWarn
ErrorError
ErrorDepthError
ErrorfError
ErrorlnError
ExitFatal
ExitDepthFatal
ExitfFatal
ExitlnFatal
FatalFatal
FatalDepthFatal
FatalfFatal
FatallnFatal

This table is rather opinionated and build for use with the Kubernetes' Go client.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author