Documentation ¶
Index ¶
- func GetLevel(module string) spilog.Level
- func HideCallerInfo(module string, level spilog.Level)
- func Initialize(l spilog.LoggerProvider)
- func IsCallerInfoEnabled(module string, level spilog.Level) bool
- func IsEnabledFor(module string, level spilog.Level) bool
- func ParseLevel(level string) (spilog.Level, error)
- func SetLevel(module string, level spilog.Level)
- func ShowCallerInfo(module string, level spilog.Level)
- type Log
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLevel ¶
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 ¶
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 spilog.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 ¶
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 ¶
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 ¶
ParseLevel returns the log level from a string representation.
Parameters: level is logging level in string representation Returns: logging level
func SetLevel ¶
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 ¶
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 ¶
Log is an implementation of Logger interface. It encapsulates default or custom logger to provide module and level based logging.
func New ¶
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.