Documentation
¶
Index ¶
- func SetLogLevel(level Level)
- type Level
- type LogHelper
- func (lh *LogHelper) Debug(ctx context.Context, args ...interface{})
- func (lh *LogHelper) Error(ctx context.Context, args ...interface{})
- func (lh *LogHelper) Fatal(ctx context.Context, args ...interface{})
- func (lh *LogHelper) Info(ctx context.Context, args ...interface{})
- func (lh *LogHelper) Warn(ctx context.Context, args ...interface{})
- type LogrusContextHook
- type LogrusOtelHook
- type LogrusOtelShutdownHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLogLevel ¶
func SetLogLevel(level Level)
SetLogLevel updates the log level of the logger library.
Types ¶
type Level ¶
type Level uint32
Level is an enumeration for the log levels to abstract it from the logging library.
type LogHelper ¶
LogHelper is an abstraction for the Logger instance to enable simpler switching between logging libraries.
func GetLogHelper ¶
func GetLogHelper() *LogHelper
GetLogHelper returns the LogHelper instance or creates a new one if it does not exist according to the singleton pattern.
type LogrusContextHook ¶
type LogrusContextHook struct{}
LogrusContextHook is a hook for logrus that adds the file and line number to the log entry.
func (LogrusContextHook) Fire ¶
func (hook LogrusContextHook) Fire(entry *logrus.Entry) error
Fire is called when the LogrusContextHook is activated (when a log entry is made).
func (LogrusContextHook) Levels ¶
func (hook LogrusContextHook) Levels() []logrus.Level
Levels returns all log levels for which the LogrusContextHook should be activated (warning level and higher, because runtime.Caller is expensive and debug, because it should be disabled in production).
type LogrusOtelHook ¶
type LogrusOtelHook struct{}
LogrusOtelHook is a hook for logrus that enables logging to OpenTelemetry.
func (LogrusOtelHook) Fire ¶
func (hook LogrusOtelHook) Fire(entry *logrus.Entry) error
Fire is called when the LogrusOtelHook is activated (when a log entry is made).
func (LogrusOtelHook) Levels ¶
func (hook LogrusOtelHook) Levels() []logrus.Level
Levels returns all log levels for which the LogrusOtelHook should be activated (warning level and higher).
type LogrusOtelShutdownHook ¶
type LogrusOtelShutdownHook struct{}
LogrusOtelShutdownHook is a hook for logrus that ensures that the connection to OpenTelemetry is shut down properly.
func (LogrusOtelShutdownHook) Fire ¶
func (hook LogrusOtelShutdownHook) Fire(entry *logrus.Entry) error
Fire is called when the LogrusOtelShutdownHook is activated (when a fatal log entry is made).
func (LogrusOtelShutdownHook) Levels ¶
func (hook LogrusOtelShutdownHook) Levels() []logrus.Level
Levels returns all log levels for which the LogrusOtelShutdownHook should be activated (fatal level and higher since it terminates the program).