logging

package
v0.0.0-...-4e1b064 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(name string) *zap.Logger

func IsValidLogLevel

func IsValidLogLevel(level string) bool

func NewLogger

func NewLogger(cfg *LoggingConfig) *zap.Logger

NewLogger initializes a zap.Logger instance if it has not been initialized already and returns the same instance for subsequent calls.

func SetLogLevel

func SetLogLevel(level string) error

SetLogLevel dynamically updates the log level at runtime

Types

type LoggingConfig

type LoggingConfig struct {
	Level      string `mapstructure:"level"`
	FilePath   string `mapstructure:"file_path"`
	MaxSize    int    `mapstructure:"max_size"`
	MaxBackups int    `mapstructure:"max_backups"`
	MaxAge     int    `mapstructure:"max_age"`
	Compress   bool   `mapstructure:"compress"`
	DebugMode  bool   `mapstructure:"debug_mode"`
	AddTime    bool   `mapstructure:"add_time"`
}

func NewLoggingConfig

func NewLoggingConfig(level, filePath string, maxSize, maxBackups, maxAge int, compress, debugMode, addTime bool) *LoggingConfig

NewLoggingConfig creates a new logging configuration.

Jump to

Keyboard shortcuts

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