Documentation
¶
Index ¶
- func OptionWithDoubleLine(l *LoggerImpl) error
- func WithLogger(ctx context.Context, logger Logger) context.Context
- type Field
- type Logger
- type LoggerImpl
- func (l *LoggerImpl) Debug(ctx context.Context, msg string, fields ...Field)
- func (l *LoggerImpl) Debugf(ctx context.Context, format string, args ...any)
- func (l *LoggerImpl) Error(ctx context.Context, msg string, fields ...Field)
- func (l *LoggerImpl) Errorf(ctx context.Context, format string, args ...any)
- func (l *LoggerImpl) IndentBlock(ctx context.Context, msg string, fn func(context.Context) error, ...) error
- func (l *LoggerImpl) Info(ctx context.Context, msg string, fields ...Field)
- func (l *LoggerImpl) Infof(ctx context.Context, format string, args ...any)
- func (l *LoggerImpl) Warning(ctx context.Context, msg string, fields ...Field)
- func (l *LoggerImpl) Warningf(ctx context.Context, format string, args ...any)
- func (l *LoggerImpl) WithField(key string, value interface{}) Logger
- func (l *LoggerImpl) WithFields(fields ...Field) Logger
- func (l *LoggerImpl) WithIndent() Logger
- func (l *LoggerImpl) WithIndentValue(v int) Logger
- func (l *LoggerImpl) WithLaw(law string) Logger
- func (l *LoggerImpl) WithName(name string) Logger
- func (l *LoggerImpl) WithService(service string) Logger
- type Options
- type TreeChar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptionWithDoubleLine ¶
func OptionWithDoubleLine(l *LoggerImpl) error
Types ¶
type Field ¶
type Field struct {
Key string
Value interface{}
}
Field represents a key-value pair for structured logging
type Logger ¶
type Logger interface {
Debug(ctx context.Context, msg string, fields ...Field)
Info(ctx context.Context, msg string, fields ...Field)
Warning(ctx context.Context, msg string, fields ...Field)
Error(ctx context.Context, msg string, fields ...Field)
Debugf(ctx context.Context, format string, args ...any)
Infof(ctx context.Context, format string, args ...any)
Warningf(ctx context.Context, format string, args ...any)
Errorf(ctx context.Context, format string, args ...any)
WithName(name string) Logger
WithService(service string) Logger
WithLaw(law string) Logger
WithField(key string, value any) Logger
WithFields(fields ...Field) Logger
WithIndent() Logger
IndentBlock(ctx context.Context, msg string, fn func(context.Context) error, op ...Options) error
}
Logger interface defines the logging methods
func FromContext ¶
FromContext retrieves the logger from context
type LoggerImpl ¶
type LoggerImpl struct {
// contains filtered or unexported fields
}
LoggerImpl is the concrete implementation of Logger
func (*LoggerImpl) Debug ¶
func (l *LoggerImpl) Debug(ctx context.Context, msg string, fields ...Field)
Debug logs a debug message with indentation
func (*LoggerImpl) Debugf ¶
func (l *LoggerImpl) Debugf(ctx context.Context, format string, args ...any)
Debugf logs a debug message with indentation
func (*LoggerImpl) Error ¶
func (l *LoggerImpl) Error(ctx context.Context, msg string, fields ...Field)
Error logs an error message with indentation
func (*LoggerImpl) Errorf ¶
func (l *LoggerImpl) Errorf(ctx context.Context, format string, args ...any)
Errorf logs a debug message with indentation
func (*LoggerImpl) IndentBlock ¶
func (l *LoggerImpl) IndentBlock(ctx context.Context, msg string, fn func(context.Context) error, options ...Options) error
IndentBlock executes a function within an indented logging block
func (*LoggerImpl) Info ¶
func (l *LoggerImpl) Info(ctx context.Context, msg string, fields ...Field)
Info logs an info message with indentation
func (*LoggerImpl) Infof ¶
func (l *LoggerImpl) Infof(ctx context.Context, format string, args ...any)
Infof logs a debug message with indentation
func (*LoggerImpl) Warning ¶
func (l *LoggerImpl) Warning(ctx context.Context, msg string, fields ...Field)
Warning logs a warning message with indentation
func (*LoggerImpl) Warningf ¶
func (l *LoggerImpl) Warningf(ctx context.Context, format string, args ...any)
Warningf logs a debug message with indentation
func (*LoggerImpl) WithField ¶
func (l *LoggerImpl) WithField(key string, value interface{}) Logger
WithField returns a new logger with an additional field
func (*LoggerImpl) WithFields ¶
func (l *LoggerImpl) WithFields(fields ...Field) Logger
WithFields returns a new logger with additional fields
func (*LoggerImpl) WithIndent ¶
func (l *LoggerImpl) WithIndent() Logger
WithIndent returns a new logger with increased indentation level
func (*LoggerImpl) WithIndentValue ¶
func (l *LoggerImpl) WithIndentValue(v int) Logger
WithIndent returns a new logger with increased indentation level
func (*LoggerImpl) WithLaw ¶
func (l *LoggerImpl) WithLaw(law string) Logger
func (*LoggerImpl) WithName ¶
func (l *LoggerImpl) WithName(name string) Logger
func (*LoggerImpl) WithService ¶
func (l *LoggerImpl) WithService(service string) Logger
type Options ¶
type Options func(l *LoggerImpl) error