Skip to content

Provides basic wrappers and utility functions for logrus.

License

Notifications You must be signed in to change notification settings

opalmer/logrusutil

Repository files navigation

Logrus Wrapper

Build Status codecov Go Report Card GoDoc

This project provides very basic wrappers for logrus including:

  • Log level parsing and handling.
  • Hooks for adding additional information to log messages.

Contributions are welcome but before opening a PR consider if your request would be better served as a contribution directly to the logrus project. This project was initially created so a few different projects could share the same code.

package main

import (
	"github.com/opalmer/logrusutil"
	"github.com/Sirupsen/logrus"
)

func main() {
	// Setup the root logger and hooks.
	if err := logrusutil.ConfigureLogger(logrus.StandardLogger(), logrusutil.NewConfig()); err != nil {
		panic(err)
	}
}

Case Sensitivity

The logrus project was renamed at one point from:

github.com/Sirupsen/logrus

To:

github.com/sirupsen/logrus

This causes conflicts to occur in certain cases if one or more of your dependencies are using the old import path. This project uses sirupsen which reflects what the majority of projects are using today.