Documentation
¶
Index ¶
- func OptionWithDoubleLine(l *LoggerImpl) error
- func WithLogger(ctx context.Context, logger Logger) context.Context
- type Field
- type Logger
- type LoggerIdent
- type LoggerImpl
- func (l *LoggerImpl) Debug(msg string, fields ...Field)
- func (l *LoggerImpl) Debugf(format string, args ...any)
- func (l *LoggerImpl) Error(msg string, fields ...Field)
- func (l *LoggerImpl) Errorf(format string, args ...any)
- func (l *LoggerImpl) IndentBlock(ctx context.Context, msg string, fn func(context.Context) error, ...) error
- func (l *LoggerImpl) Info(msg string, fields ...Field)
- func (l *LoggerImpl) Infof(format string, args ...any)
- func (l *LoggerImpl) Print(name string)
- func (l *LoggerImpl) Warning(msg string, fields ...Field)
- func (l *LoggerImpl) Warningf(format string, args ...any)
- func (l *LoggerImpl) WithContext(ctx context.Context) Logger
- func (l *LoggerImpl) WithField(key string, value any) Logger
- func (l *LoggerImpl) WithFields(fields ...Field) Logger
- func (l *LoggerImpl) WithIndent() 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 Logger ¶
type Logger interface {
Debug(msg string, fields ...Field)
Info(msg string, fields ...Field)
Warning(msg string, fields ...Field)
Error(msg string, fields ...Field)
Debugf(format string, args ...any)
Infof(format string, args ...any)
Warningf(format string, args ...any)
Errorf(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
WithContext(context.Context) 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 LoggerIdent ¶
type LoggerIdent struct {
Double bool
}
type LoggerImpl ¶
type LoggerImpl struct {
IndentLvl []LoggerIdent
Parent *LoggerImpl
// contains filtered or unexported fields
}
LoggerImpl is the concrete implementation of Logger
func (*LoggerImpl) Debug ¶
func (l *LoggerImpl) Debug(msg string, fields ...Field)
Debug logs a debug message with indentation
func (*LoggerImpl) Debugf ¶
func (l *LoggerImpl) Debugf(format string, args ...any)
Debugf logs a debug message with indentation
func (*LoggerImpl) Error ¶
func (l *LoggerImpl) Error(msg string, fields ...Field)
Error logs an error message with indentation
func (*LoggerImpl) Errorf ¶
func (l *LoggerImpl) Errorf(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(msg string, fields ...Field)
Info logs an info message with indentation
func (*LoggerImpl) Infof ¶
func (l *LoggerImpl) Infof(format string, args ...any)
Infof logs a debug message with indentation
func (*LoggerImpl) Print ¶
func (l *LoggerImpl) Print(name string)
func (*LoggerImpl) Warning ¶
func (l *LoggerImpl) Warning(msg string, fields ...Field)
Warning logs a warning message with indentation
func (*LoggerImpl) Warningf ¶
func (l *LoggerImpl) Warningf(format string, args ...any)
Warningf logs a debug message with indentation
func (*LoggerImpl) WithContext ¶
func (l *LoggerImpl) WithContext(ctx context.Context) Logger
func (*LoggerImpl) WithField ¶
func (l *LoggerImpl) WithField(key string, value any) 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) 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