logging

package
v4.38.8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatText = "text"
	FormatJSON = "json"
)

Log Format values.

View Source
const (
	LevelTrace = "trace"
	LevelDebug = "debug"
	LevelInfo  = "info"
	LevelWarn  = "warn"
	LevelError = "error"
)

Log Level values.

View Source
const (
	FieldRemoteIP   = "remote_ip"
	FieldMethod     = "method"
	FieldPath       = "path"
	FieldPathRaw    = "path_raw"
	FieldStatusCode = "status_code"
)

Field names.

Variables

This section is empty.

Functions

func ConfigureLogger added in v4.38.0

func ConfigureLogger(config schema.Log, log bool) (err error)

ConfigureLogger configures the default loggers level, formatting, and the output destinations.

func FormatFilePath added in v4.38.0

func FormatFilePath(in string, now time.Time) (out string)

FormatFilePath formats a file path with the given time.

func InitializeLogger

func InitializeLogger(config schema.Log, log bool) (err error)

InitializeLogger configures the default logger similar to ConfigureLogger but also configures the stack levels hook.

func Logger

func Logger() *logrus.Logger

Logger returns the standard logrus logger.

Types

type CtxPrintfLogger added in v4.36.8

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

CtxPrintfLogger is a logger that implements a common Printf logger with a ctx.

func LoggerCtxPrintf added in v4.36.8

func LoggerCtxPrintf(level logrus.Level) (logger *CtxPrintfLogger)

LoggerCtxPrintf returns a new CtxPrintfLogger given a level.

func (*CtxPrintfLogger) Printf added in v4.36.8

func (l *CtxPrintfLogger) Printf(_ context.Context, format string, args ...any)

Printf is the implementation of the interface.

type LogLevel added in v4.38.8

type LogLevel string

func (LogLevel) Level added in v4.38.8

func (l LogLevel) Level() logrus.Level

type PrintfLogger added in v4.36.8

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

PrintfLogger is a logger that implements a common Printf logger.

func LoggerPrintf added in v4.36.8

func LoggerPrintf(level logrus.Level) (logger *PrintfLogger)

LoggerPrintf returns a new PrintfLogger given a level.

func (*PrintfLogger) Printf added in v4.36.8

func (l *PrintfLogger) Printf(format string, args ...any)

Printf is the implementation of the interface.

Jump to

Keyboard shortcuts

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