logger

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: AGPL-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 Logger

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

Logger provides structured logging

func New

func New(development bool, level string, encoding string) (*Logger, error)

New creates a new logger

func NewObserved

func NewObserved() (*Logger, *observer.ObservedLogs)

NewObserved returns a Logger backed by an in-memory observer core and the ObservedLogs sink for assertions. The observer captures all entries at WarnLevel and above.

Intended for unit tests only. Use in production is not meaningful — the observer only retains entries in memory with no output.

Usage:

log, logs := logger.NewObserved()
svc, _ := auth.New(cfg, log, db, cache)
// ... exercise svc ...
require.Equal(t, 1, logs.FilterMessage("auth: rememberMeDuration is shorter...").Len())

func (*Logger) Debug

func (l *Logger) Debug(msg string, keysAndValues ...interface{})

Debug logs a debug message

func (*Logger) Error

func (l *Logger) Error(msg string, err error, keysAndValues ...interface{})

Error logs an error message

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, err error, keysAndValues ...interface{})

Fatal logs a fatal message and exits

func (*Logger) Info

func (l *Logger) Info(msg string, keysAndValues ...interface{})

Info logs an info message

func (*Logger) Sync

func (l *Logger) Sync() error

Sync flushes any buffered log entries

func (*Logger) Warn

func (l *Logger) Warn(msg string, keysAndValues ...interface{})

Warn logs a warning message

func (*Logger) With

func (l *Logger) With(keysAndValues ...interface{}) pkginterfaces.LoggerInterface

With returns a logger with additional fields

func (*Logger) ZapLogger

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

ZapLogger returns the underlying zap.Logger for callers that need direct access (e.g. structured logging with zap-specific APIs).

Jump to

Keyboard shortcuts

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