log

package
v0.0.0-...-35b42f4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix contextKey = "prefix"

Prefix is the context key for the log prefix.

Variables

This section is empty.

Functions

func ContextWithPrefix

func ContextWithPrefix(prefix string) context.Context

ContextWithPrefix creates a context.Context which has given prefix as value.

Types

type ContextPrefixFormatter

type ContextPrefixFormatter struct {
	*logrus.TextFormatter
}

ContextPrefixFormatter prefixes log messages based on the entry context.

func (*ContextPrefixFormatter) Format

func (f *ContextPrefixFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format implements logrus.Formatter. Will prepend the message of entry with a prefix present in the log context if exists. For all other formatting the default logrus.TextFormatter is used.

type LineWriter

type LineWriter func(args ...interface{})

LineWriter is a printf-style func which satisfies the io.Writer interface.

func (LineWriter) Write

func (w LineWriter) Write(p []byte) (n int, err error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

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