zap

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogConfig

type LogConfig struct {
	JSONLogging bool
	LogLevel    string // Log level: "debug", "info", "warn", "error"
	AppName     string
}

type Logger

type Logger struct {
	Fields map[string]zapcore.Field
	// contains filtered or unexported fields
}

func New

func New(config LogConfig, fields ...log.Field) *Logger

Init initializes a new AppLogger with the given configuration and optional fields.

func (*Logger) Debug

func (cl *Logger) Debug(format string, args ...any)

Debugf logs a debug message with formatting.

func (*Logger) Error

func (cl *Logger) Error(format string, err error, args ...any)

Errorf logs an error message with formatting.

func (*Logger) Info

func (cl *Logger) Info(format string, args ...any)

Infof logs an informational message with formatting.

func (*Logger) LogRequest

func (l *Logger) LogRequest(data log.LogData)

func (*Logger) Named

func (cl *Logger) Named(name string) log.Writer

Named creates a new AppLogger with a specific name.

func (*Logger) New

func (cl *Logger) New(name string, fields ...log.Field) log.Writer

New creates a new AppLogger with additional fields and a name.

func (*Logger) Sync

func (cl *Logger) Sync()

Sync flushes any buffered log entries.

func (*Logger) Warn

func (cl *Logger) Warn(format string, args ...any)

Warnf logs a warning message with formatting.

func (*Logger) With

func (cl *Logger) With(fields ...log.Field) log.Writer

With adds fields to the logger and returns a new AppLogger.

Jump to

Keyboard shortcuts

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