logutil

package
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2019 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package logutil is a utility package for github.com/sirupsen/logrus.

Index

Examples

Constants

View Source
const (
	// ComponentKey is the field key used to store the component name.
	ComponentKey = "component"

	// MethodKey is the field key used to store the methodname.
	MethodKey = "method"
)

Variables

This section is empty.

Functions

func AddComponent added in v0.3.0

func AddComponent(e *logrus.Entry, v zero.Interface) *logrus.Entry

AddComponent appends the component name to the logrus.Entry.

Example
Output:

level=info msg="Added 'SomeStruct' component." component=logutil_test.SomeStruct
level=info msg="Added 'SomeFunc' component." component="[logutil_test.SomeStruct logutil_test.SomeFunc]"
level=info msg="First logger component unchanged." component=logutil_test.SomeStruct

func NoopEntry

func NoopEntry() *logrus.Entry

NoopEntry returns a no-op logrus.NoopEntry.

Example
Output:

level=info msg="Oh-ho, who's this?" kind=default

func NoopLogger

func NoopLogger() *logrus.Logger

NoopLogger returns a no-op logrus.NoopLogger.

func WithMethod added in v0.3.0

func WithMethod(e *logrus.Entry, v zero.Interface) *logrus.Entry

WithMethod adds the name of the method v to the logrus.Entry.

Example
Output:

level=info msg="Hello from method!" method=LogWithMethod

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL