adapter

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package adapter provides concrete implementations of the logger interface.

The adapter package bridges the abstract Logger interface with concrete implementations that format and output log messages. It handles buffering, formatting, and writing log entries to various output destinations.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoFilePathSet indicates that the file path is not set for file output.
	ErrNoFilePathSet = ewrap.New("file path not set for file output")
	// ErrEncoderNotFound indicates that a requested encoder could not be resolved.
	ErrEncoderNotFound = ewrap.New("encoder not found")
)

Functions

func NewAdapter

func NewAdapter(ctx context.Context, config hyperlogger.Config) (hyperlogger.Logger, error)

NewAdapter creates a new logger adapter with the given configuration.

Types

type Adapter

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

Adapter implements the hyperlogger.Logger interface.

func (*Adapter) Debug

func (a *Adapter) Debug(msg string)

Debug logs a message at debug level.

func (*Adapter) Debugf

func (a *Adapter) Debugf(format string, args ...any)

Debugf logs a formatted message at debug level.

func (*Adapter) Error

func (a *Adapter) Error(msg string)

Error logs a message at error level.

func (*Adapter) Errorf

func (a *Adapter) Errorf(format string, args ...any)

Errorf logs a formatted message at error level.

func (*Adapter) Fatal

func (a *Adapter) Fatal(msg string)

Fatal logs a message at fatal level then calls os.Exit(1).

func (*Adapter) Fatalf

func (a *Adapter) Fatalf(format string, args ...any)

Fatalf logs a formatted message at fatal level.

func (*Adapter) GetConfig

func (a *Adapter) GetConfig() *hyperlogger.Config

GetConfig returns the current logger configuration.

func (*Adapter) GetLevel

func (a *Adapter) GetLevel() hyperlogger.Level

GetLevel returns the current logging level.

func (*Adapter) Info

func (a *Adapter) Info(msg string)

Info logs a message at info level.

func (*Adapter) Infof

func (a *Adapter) Infof(format string, args ...any)

Infof logs a formatted message at info level.

func (*Adapter) SetLevel

func (a *Adapter) SetLevel(level hyperlogger.Level)

SetLevel sets the logging level.

func (*Adapter) Sync

func (a *Adapter) Sync() error

Sync ensures that all logs have been written. Flushes the AsyncWriter if one is being used.

func (*Adapter) Trace

func (a *Adapter) Trace(msg string)

Trace logs a message at trace level.

func (*Adapter) Tracef

func (a *Adapter) Tracef(format string, args ...any)

Tracef logs a formatted message at trace level.

func (*Adapter) Warn

func (a *Adapter) Warn(msg string)

Warn logs a message at warn level.

func (*Adapter) Warnf

func (a *Adapter) Warnf(format string, args ...any)

Warnf logs a formatted message at warn level.

func (*Adapter) WithContext

func (a *Adapter) WithContext(ctx context.Context) hyperlogger.Logger

WithContext returns a new logger with the given context.

func (*Adapter) WithError

func (a *Adapter) WithError(err error) hyperlogger.Logger

WithError adds an error field to the hyperlogger.

func (*Adapter) WithField

func (a *Adapter) WithField(key string, value any) hyperlogger.Logger

WithField adds a field to the hyperlogger.

func (*Adapter) WithFields

func (a *Adapter) WithFields(fields ...hyperlogger.Field) hyperlogger.Logger

WithFields adds fields to the hyperlogger.

Jump to

Keyboard shortcuts

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