log

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: BSD-2-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenID

func GenID() string

GenID generates an id to be used as a logger ID

Types

type Logger

type Logger interface {
	Debug() *zerolog.Event // Debug returns a debug level zerolog event
	Disable()              // Disable disables this logger permanently
	Error() *zerolog.Event // Error returns an error level zerolog event
	IDGet() string         // IDGet returns the request ID for this logger
	IDSet(id string)       // IDSet sets a request id in the logger
	Info() *zerolog.Event  // Info returns an info level zerolog event
	ParentID() string      // ParentID returns the ID of the parent of this logger, or an empty string if there is no parent
	SetDebug(bool)         // SetDebug enables or disables debug level logging for this logger
	SetOutput(io.Writer)   // SetOutput sets a new output writer for the logger
	SubLogger() Logger     // SubLogger returns a child logger to this logger
	Warn() *zerolog.Event  // Warn returns a warn level zerolog event
}

Logger interface definition

NOTE: Disabling a logger zeros all internally stored values. Further usage

after disabling will result in nil pointer de-referencing and crashes.

func NewLogger

func NewLogger(debug bool, id string, w io.Writer) Logger

NewLogger returns a new logger for usage

Jump to

Keyboard shortcuts

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