logging

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zap.Field)

Debug logs a message at the debug level.

func Debugf

func Debugf(format string, args ...interface{})

Debugf logs a formatted message at the debug level.

func Error

func Error(msg string, fields ...zap.Field)

Error logs a message at the error level.

func Errorf

func Errorf(format string, args ...interface{})

Errorf logs a formatted message at the error level.

func Fatal

func Fatal(msg string, fields ...zap.Field)

Fatal logs a message at the fatal level, which causes the program to exit.

func GetLogger

func GetLogger() *zap.Logger

GetLogger returns the logger instance. If the logger has not been initialized, it sets it up with a default configuration.

func Info

func Info(msg string, fields ...zap.Field)

Info logs a message at the info level.

func Infof

func Infof(format string, args ...interface{})

Infof logs a formatted message at the info level.

func InitLoggerFromConfig

func InitLoggerFromConfig(cfg *types.LogConfig) *zap.Logger

InitLoggerFromConfig initializes the logger from a configuration object. It sets up the logger with specified settings for level, file path, rotation, and console output.

func Setup

func Setup(level string, filePath string, maxSize, maxBackups, maxAge int, compress bool, env string, enableConsole bool)

Setup initializes the logging system. It configures the logger's level, output path, rotation policies, and console logging based on the provided parameters. This function is designed to be called only once.

func Sugar

func Sugar() *zap.SugaredLogger

Sugar returns a `SugaredLogger` for more convenient logging methods.

func Sync

func Sync()

Sync flushes any buffered log entries.

func Warn

func Warn(msg string, fields ...zap.Field)

Warn logs a message at the warn level.

func Warnf

func Warnf(format string, args ...interface{})

Warnf logs a formatted message at the warn level.

Types

This section is empty.

Jump to

Keyboard shortcuts

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