log

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level indicates the severity of the data being logged

const (
	// LevelCritical alerts about severe problems. Most of the time, needs some human intervention ASAP
	LevelCritical Level = iota + 1
	// LevelError alerts about events that are likely to cause problems
	LevelError
	// LevelWarning warns about events the might cause problems to the system
	LevelWarning
	// LevelInfo are routine information
	LevelInfo
	// LevelDebug are debug or trace information
	LevelDebug
)

func (Level) String

func (l Level) String() string

String returns the name of the LogLevel

type LogAttribute

type LogAttribute string

LogAttribute represents an information to be extracted from the context and included into the log

type LogAttributeSet

type LogAttributeSet map[LogAttribute]bool

LogAttributeSet is a set of LogAttributes

type Logger

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

Logger is the structure responsible for log data

func NewLogger

func NewLogger(in LoggerInput) *Logger

NewLogger constructs a new Logger instance

func (Logger) Critical

func (l Logger) Critical(ctx context.Context, err error)

Critical logs critical data

func (Logger) Debug

func (l Logger) Debug(ctx context.Context, msg string, args ...interface{})

Debug logs debug data

func (Logger) Error

func (l Logger) Error(ctx context.Context, err error)

Error logs error data

func (Logger) Info

func (l Logger) Info(ctx context.Context, msg string, args ...interface{})

Info logs info data

func (Logger) Warning

func (l Logger) Warning(ctx context.Context, msg string, args ...interface{})

Warning logs warning data

type LoggerInput

type LoggerInput struct {
	Level      string
	Attributes LogAttributeSet
}

LoggerInput defines the dependencies of a Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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