log

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLevel

func GetLevel(module string) log.Level

GetLevel - getting log level for given module

Parameters:
module is module name

Returns:
logging level

If not set default logging level is info.

func HideCallerInfo

func HideCallerInfo(module string, level log.Level)

HideCallerInfo - Do not show caller info in log lines for given log level and module

Parameters:
module is module name
level is logging level

note: based on implementation of custom logger, callerinfo info may not be available for custom logging provider

func Initialize

func Initialize(l log.LoggerProvider)

Initialize sets new custom logging provider which takes over logging operations. It is required to call this function before making any loggings for using custom loggers.

func IsCallerInfoEnabled

func IsCallerInfoEnabled(module string, level log.Level) bool

IsCallerInfoEnabled - returns if caller info enabled for given log level and module

Parameters:
module is module name
level is logging level

Returns:
is caller info enabled for this module and level

note: based on implementation of custom logger, callerinfo info may not be available for custom logging provider

func IsEnabledFor

func IsEnabledFor(module string, level log.Level) bool

IsEnabledFor - Check if given log level is enabled for given module

Parameters:
module is module name
level is logging level

Returns:
is logging enabled for this module and level

If not set default logging level is info.

func ParseLevel

func ParseLevel(level string) (log.Level, error)

ParseLevel returns the log level from a string representation.

Parameters:
level is logging level in string representation

Returns:
logging level

func SetLevel

func SetLevel(module string, level log.Level)

SetLevel - setting log level for given module

Parameters:
module is module name
level is logging level

If not set default logging level is info.

func ShowCallerInfo

func ShowCallerInfo(module string, level log.Level)

ShowCallerInfo - Show caller info in log lines for given log level and module

Parameters:
module is module name
level is logging level

note: based on implementation of custom logger, callerinfo info may not be available for custom logging provider

Types

type Log

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

Log is an implementation of Logger interface. It encapsulates default or custom logger to provide module and level based logging.

func New

func New(module string) *Log

New creates and returns a Logger implementation based on given module name. note: the underlying logger instance is lazy initialized on first use. To use your own logger implementation provide logger provider in 'Initialize()' before logging any line. If 'Initialize()' is not called before logging any line then default logging implementation will be used.

func (*Log) Debugf

func (l *Log) Debugf(msg string, args ...interface{})

Debugf calls Debugf function of underlying logger.

func (*Log) Errorf

func (l *Log) Errorf(msg string, args ...interface{})

Errorf calls Errorf function of underlying logger.

func (*Log) Fatalf

func (l *Log) Fatalf(msg string, args ...interface{})

Fatalf calls Fatalf function of underlying logger should possibly cause system shutdown based on implementation.

func (*Log) Infof

func (l *Log) Infof(msg string, args ...interface{})

Infof calls Infof function of underlying logger.

func (*Log) Panicf

func (l *Log) Panicf(msg string, args ...interface{})

Panicf calls Panic function of underlying logger should possibly cause panic based on implementation.

func (*Log) Warnf

func (l *Log) Warnf(msg string, args ...interface{})

Warnf calls Warnf function of underlying logger.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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