logger

package
v0.3.29-beta Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 4 Imported by: 0

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

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

func GetLogger(ctx context.Context) *logrus.Entry

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

func SetLogFormatForLogger(logger *logrus.Logger, format string)

SetLogFormatForLogger sets the log format for a specific logger

func SetLogLevel

func SetLogLevel(level string) error

SetLogLevel sets the log level for the global logger

func SetLogLevelForLogger

func SetLogLevelForLogger(logger *logrus.Logger, level string) error

SetLogLevelForLogger sets the log level for a specific logger

func SetLogOutput

func SetLogOutput(w io.Writer)

SetLogOutput sets the output destination for the global logger

func WithLogger

func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context

WithLogger attaches a logger entry to the given context, making it retrievable via GetLogger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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