slog

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLogOutput io.Writer = os.Stderr
	LogLevel         log.Level = log.DebugLevel
)

Package variables for output control.

Functions

func Disable

func Disable() io.Writer

Disable disables the logging output and returns the previous writer.

func SetLogLevel

func SetLogLevel(level string) error

SetLogLevel changes the logging level to correspond with the provided argument. Accepted argument values are "panic", "fatal", "error", "warn", "info", "debug", "trace".

func SetLogOutput

func SetLogOutput(out io.Writer) io.Writer

SetLogOutput changes the logging output to the specified writer, and returns the old one.

Types

type Logger

type Logger = log.Entry

Logger is a type alias for logrus.Entry.

func NewLogger

func NewLogger(component string) *Logger

NewLogger returns a new logger for a component.

type WatermillLogger

type WatermillLogger struct {
	*Logger
}

WatermillLogger is the logger used for watermill.

func NewWLogger

func NewWLogger(component string) *WatermillLogger

NewWLogger initializes a new WatermillLogger.

func (*WatermillLogger) Debug

func (l *WatermillLogger) Debug(msg string, fields watermill.LogFields)

Debug creates a new debug log entry.

func (*WatermillLogger) Error

func (l *WatermillLogger) Error(msg string, err error, fields watermill.LogFields)

func (*WatermillLogger) Info

func (l *WatermillLogger) Info(msg string, fields watermill.LogFields)

Info creates a new info log entry.

func (*WatermillLogger) Trace

func (l *WatermillLogger) Trace(msg string, fields watermill.LogFields)

Trace creates a new trace log entry.

func (*WatermillLogger) With

With adds a map of fields to the log entry.

Jump to

Keyboard shortcuts

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