Documentation
¶
Overview ¶
Package logger provides context-aware structured logging functionality using logrus. It offers global logger access and context-based logger management for consistent logging across the application.
Index ¶
- Variables
- func GetLogger(ctx context.Context) *logrus.Entry
- func SetLogFormat(format string)
- func SetLogFormatForLogger(logger *logrus.Logger, format string)
- func SetLogLevel(level string) error
- func SetLogLevelForLogger(logger *logrus.Logger, level string) error
- func SetLogOutput(w io.Writer)
- func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // G is a convenience alias for GetLogger, providing quick access to context-aware logger retrieval. G = GetLogger // L is the global logger entry used as a fallback when no logger is found in context. L = logrus.NewEntry(newLogger()) )
Functions ¶
func GetLogger ¶
GetLogger retrieves the logger entry from the context. If no logger is found, it returns the global logger L with the context attached.
func SetLogFormat ¶
func SetLogFormat(format string)
SetLogFormat sets the log format for the global logger
func SetLogFormatForLogger ¶
SetLogFormatForLogger sets the log format for a specific logger
func SetLogLevel ¶
SetLogLevel sets the log level for the global logger
func SetLogLevelForLogger ¶
SetLogLevelForLogger sets the log level for a specific logger
func SetLogOutput ¶
SetLogOutput sets the output destination for the global logger
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.