logger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Level       string // Log level: debug, info, warn, error
	Environment string // Environment: production, development
}

func DefaultConfig

func DefaultConfig() Config

DefaultConfig provides a baseline configuration for the logger.

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func GetLogger

func GetLogger() *Logger

GetLogger initializes or returns the singleton logger instance.

func (*Logger) Debug

func (l *Logger) Debug(msg string, fields ...zap.Field)

Debug logs a debug message.

func (*Logger) Error

func (l *Logger) Error(msg string, fields ...zap.Field)

Error logs an error message.

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, fields ...zap.Field)

Fatal logs a fatal message and exits the application.

func (*Logger) Info

func (l *Logger) Info(msg string, fields ...zap.Field)

Info logs an informational message.

func (*Logger) LogHTTPRequest

func (l *Logger) LogHTTPRequest(method, path, traceID string, statusCode int, durationMs float64)

LogHTTPRequest logs details of an HTTP request.

func (*Logger) LogTrace

func (l *Logger) LogTrace(spanName, traceID string, durationMs float64)

LogTrace logs details of a trace span.

func (*Logger) Sync

func (l *Logger) Sync()

Sync flushes any buffered log entries.

func (*Logger) UpdateConfig

func (l *Logger) UpdateConfig(cfg Config)

UpdateConfig allows dynamic reconfiguration of the logger.

func (*Logger) Warn

func (l *Logger) Warn(msg string, fields ...zap.Field)

Warn logs a warning message.

Jump to

Keyboard shortcuts

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