formatter

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: BSD-3-Clause Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetJSONFormatter added in v0.28.4

func SetJSONFormatter(logger *logrus.Logger)

SetJSONFormatter set the JSON formatter for given logger.

func SetLogcatFormatter added in v0.14.5

func SetLogcatFormatter(logger *logrus.Logger)

SetLogcatFormatter set the logcat formatter for given logger.

func SetSyslogFormatter added in v0.28.7

func SetSyslogFormatter(logger *logrus.Logger)

SetSyslogFormatter set the text formatter for given logger.

func SetTextFormatter

func SetTextFormatter(logger *logrus.Logger)

SetTextFormatter set the text 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 ExecutionContext added in v0.28.4

type ExecutionContext string
const (
	ExecutionContextKey = "executionContext"

	HTTPSource   ExecutionContext = "HTTP"
	GRPCSource   ExecutionContext = "GRPC"
	SystemSource ExecutionContext = "SYSTEM"
)

type LogcatFormatter added in v0.14.5

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

LogcatFormatter formats logs into text what is fit for logcat

func NewLogcatFormatter added in v0.14.5

func NewLogcatFormatter() *LogcatFormatter

NewLogcatFormatter create new LogcatFormatter instance

func (*LogcatFormatter) Format added in v0.14.5

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

Format renders a single log entry

type SyslogFormatter added in v0.28.7

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

SyslogFormatter formats logs into text

func NewSyslogFormatter added in v0.28.7

func NewSyslogFormatter() *SyslogFormatter

NewSyslogFormatter create new MySyslogFormatter instance

func (*SyslogFormatter) Format added in v0.28.7

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

Format renders a single log entry

type TextFormatter

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

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