formatter

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: BSD-3-Clause Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTextFormatter

func SetTextFormatter(logger *logrus.Logger)

SetTextFormatter set the formatter for given logger.

Types

type ContextHook

type ContextHook struct {
	// contains filtered or unexported fields
}

ContextHook is a custom hook for add the source information for the entry

func NewContextHook

func NewContextHook() *ContextHook

NewContextHook instantiate a new context hook

func (ContextHook) Fire

func (hook ContextHook) Fire(entry *logrus.Entry) error

Fire extend with the source information the entry.Data

func (ContextHook) Levels

func (hook ContextHook) Levels() []logrus.Level

Levels set the supported levels for this hook

type TextFormatter

type TextFormatter struct {
	TimestampFormat string
	LevelDesc       []string
}

TextFormatter formats logs into text with included source code's path

func NewTextFormatter

func NewTextFormatter() *TextFormatter

NewTextFormatter create new MyTextFormatter instance

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