Documentation
¶
Index ¶
- Variables
- type Config
- type Format
- type Level
- type Logger
- type RotatableFile
- type StructuredLogger
- type StructuredLoggerAdapter
- func (l *StructuredLoggerAdapter) Debug(msg string, args ...any)
- func (l *StructuredLoggerAdapter) DebugContext(_ context.Context, msg string, args ...any)
- func (l *StructuredLoggerAdapter) Error(msg string, args ...any)
- func (l *StructuredLoggerAdapter) ErrorContext(_ context.Context, msg string, args ...any)
- func (l *StructuredLoggerAdapter) Info(msg string, args ...any)
- func (l *StructuredLoggerAdapter) InfoContext(_ context.Context, msg string, args ...any)
- func (l *StructuredLoggerAdapter) Warn(msg string, args ...any)
- func (l *StructuredLoggerAdapter) WarnContext(_ context.Context, msg string, args ...any)
- func (l *StructuredLoggerAdapter) With(args ...any) StructuredLogger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultFileFlags = os.O_CREATE | os.O_APPEND | os.O_WRONLY DefaultFileMode os.FileMode = 0o600 DefaultDirMode os.FileMode = 0o700 )
View Source
var NopLogger = nopLogger{} //nolint:gochecknoglobals // nop implementation
NopLogger is a logger that does nothing.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config is a configuration for the loggers.
func DefaultConfig ¶
func DefaultConfig() *Config
type Format ¶ added in v1.5.0
type Format int
Formats start from 1 to avoid zero value in help printer.
type Logger ¶
type Logger interface {
Errorf(format string, args ...any)
Infof(format string, args ...any)
Debugf(format string, args ...any)
}
Logger is the logger used by the forwarder package.
type RotatableFile ¶ added in v1.3.2
type RotatableFile struct {
// contains filtered or unexported fields
}
func NewRotatableFile ¶ added in v1.3.2
func NewRotatableFile(f *os.File) *RotatableFile
func (*RotatableFile) Close ¶ added in v1.3.2
func (w *RotatableFile) Close() error
func (*RotatableFile) Reopen ¶ added in v1.3.2
func (w *RotatableFile) Reopen() error
type StructuredLogger ¶ added in v1.5.0
type StructuredLogger interface {
Error(msg string, args ...any)
Warn(msg string, args ...any)
Info(msg string, args ...any)
Debug(msg string, args ...any)
ErrorContext(ctx context.Context, msg string, args ...any)
WarnContext(ctx context.Context, msg string, args ...any)
InfoContext(ctx context.Context, msg string, args ...any)
DebugContext(ctx context.Context, msg string, args ...any)
With(args ...any) StructuredLogger
}
StructuredLogger is the preferred logging interface.
type StructuredLoggerAdapter ¶ added in v1.5.0
type StructuredLoggerAdapter struct {
// contains filtered or unexported fields
}
func NewStructuredLoggerAdapter ¶ added in v1.5.0
func NewStructuredLoggerAdapter(log Logger) *StructuredLoggerAdapter
func (*StructuredLoggerAdapter) Debug ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) Debug(msg string, args ...any)
func (*StructuredLoggerAdapter) DebugContext ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) DebugContext(_ context.Context, msg string, args ...any)
func (*StructuredLoggerAdapter) Error ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) Error(msg string, args ...any)
func (*StructuredLoggerAdapter) ErrorContext ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) ErrorContext(_ context.Context, msg string, args ...any)
func (*StructuredLoggerAdapter) Info ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) Info(msg string, args ...any)
func (*StructuredLoggerAdapter) InfoContext ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) InfoContext(_ context.Context, msg string, args ...any)
func (*StructuredLoggerAdapter) Warn ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) Warn(msg string, args ...any)
func (*StructuredLoggerAdapter) WarnContext ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) WarnContext(_ context.Context, msg string, args ...any)
func (*StructuredLoggerAdapter) With ¶ added in v1.5.0
func (l *StructuredLoggerAdapter) With(args ...any) StructuredLogger
Click to show internal directories.
Click to hide internal directories.