formatter

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallerFormat

func CallerFormat(caller *runtime.Frame) string

CallerFormat format entry caller as text with fmt.Sprintf

func DefaultFormat

func DefaultFormat(value interface{}) string

DefaultFormat format value as text with fmt.Sprintf

func JSONFormat

func JSONFormat(value interface{}) string

JSONFormat format value as json

func NeedsQuoting

func NeedsQuoting(text string) bool

NeedsQuoting checks quoting needed for text

Types

type TextFormatter

type TextFormatter struct {
	logrus.TextFormatter

	SourceField  string
	FormatValue  func(value interface{}) string
	FormatCaller func(caller *runtime.Frame) string
	// contains filtered or unexported fields
}

TextFormatter formats logs into text

func New

func New() *TextFormatter

New creates new formatter

func (*TextFormatter) Format

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

Format renders a single log entry

Jump to

Keyboard shortcuts

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