logger

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AdditionalFieldsFrom

func AdditionalFieldsFrom(fields map[string]any) []zap.Field

Types

type Logger

type Logger struct {
	Info   func(msg string, fields ...zap.Field)
	Debug  func(msg string, fields ...zap.Field)
	Warn   func(msg string, fields ...zap.Field)
	Error  func(msg string, fields ...zap.Field)
	Infof  func(format string, a ...any)
	Debugf func(format string, a ...any)
	Warnf  func(format string, a ...any)
	Errorf func(format string, a ...any)
	// contains filtered or unexported fields
}

Logger is a custom logger that wraps zap.Logger

func NewLogger

func NewLogger(writer io.Writer, tag string, isProd bool) *Logger

func NewRotatingFileLogger

func NewRotatingFileLogger(
	filePath string,
	tag string,
	isProd bool,
	sizeThresholdMb int,
	backupCount int,
	logfileAgeThreshold int,
) *Logger

func (*Logger) Close

func (l *Logger) Close() error

Close is used to clean up resources if needed

func (*Logger) CorrelationLogger

func (l *Logger) CorrelationLogger(
	_correlationKey string,
	_correlationId string,
) *Logger

Correlation Logger

func (*Logger) LogFault added in v0.1.9

func (l *Logger) LogFault(
	f fault.Fault,
	bundle *i18n.Bundle,
	lang ...string,
)

LogFault logs a fault with translated message using the provided i18n bundle at Error level Language is optional; if not provided, defaults to "en" (English)

func (*Logger) With

func (l *Logger) With(
	fields map[string]any,
) *Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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