logger

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 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 Field

type Field struct {
	Key   string
	Value any
}

Field represents a key-value pair for structured logging

func F

func F(key string, value any) Field

F creates a new Field

type Logger

type Logger interface {
	Info(msg string, fields ...Field)
	Error(msg string, fields ...Field)
	Debug(msg string, fields ...Field)
	Warn(msg string, fields ...Field)
	Sync() error
}

Logger is the interface for logging

func NewSimpleLogger

func NewSimpleLogger() Logger

NewSimpleLogger creates a new SimpleLogger

type SimpleLogger

type SimpleLogger struct{}

SimpleLogger is a simple fmt-based logger for CLI/batch use and testing

func (*SimpleLogger) Debug

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

func (*SimpleLogger) Error

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

func (*SimpleLogger) Info

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

func (*SimpleLogger) Sync

func (l *SimpleLogger) Sync() error

func (*SimpleLogger) Warn

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

type ZapLogger

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

ZapLogger wraps zap.Logger to implement Logger interface

func NewZapLogger

func NewZapLogger() (*ZapLogger, error)

NewZapLogger creates a new ZapLogger for web server use

func (*ZapLogger) Debug

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

func (*ZapLogger) Error

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

func (*ZapLogger) GetZapLogger

func (l *ZapLogger) GetZapLogger() *zap.Logger

GetZapLogger returns the underlying zap.Logger

func (*ZapLogger) Info

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

func (*ZapLogger) Sync

func (l *ZapLogger) Sync() error

func (*ZapLogger) Warn

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

Jump to

Keyboard shortcuts

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