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 ¶
- Variables
- func NewAdapter(ctx context.Context, config hyperlogger.Config) (hyperlogger.Logger, error)
- type Adapter
- func (a *Adapter) Debug(msg string)
- func (a *Adapter) Debugf(format string, args ...any)
- func (a *Adapter) Error(msg string)
- func (a *Adapter) Errorf(format string, args ...any)
- func (a *Adapter) Fatal(msg string)
- func (a *Adapter) Fatalf(format string, args ...any)
- func (a *Adapter) GetConfig() *hyperlogger.Config
- func (a *Adapter) GetLevel() hyperlogger.Level
- func (a *Adapter) Info(msg string)
- func (a *Adapter) Infof(format string, args ...any)
- func (a *Adapter) SetLevel(level hyperlogger.Level)
- func (a *Adapter) Sync() error
- func (a *Adapter) Trace(msg string)
- func (a *Adapter) Tracef(format string, args ...any)
- func (a *Adapter) Warn(msg string)
- func (a *Adapter) Warnf(format string, args ...any)
- func (a *Adapter) WithContext(ctx context.Context) hyperlogger.Logger
- func (a *Adapter) WithError(err error) hyperlogger.Logger
- func (a *Adapter) WithField(key string, value any) hyperlogger.Logger
- func (a *Adapter) WithFields(fields ...hyperlogger.Field) hyperlogger.Logger
Constants ¶
This section is empty.
Variables ¶
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) 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) SetLevel ¶
func (a *Adapter) SetLevel(level hyperlogger.Level)
SetLevel sets the logging level.
func (*Adapter) Sync ¶
Sync ensures that all logs have been written. Flushes the AsyncWriter if one is being used.
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.