Documentation
¶
Index ¶
- func AppendToContext(ctx context.Context, attrs ...any) context.Context
- func AttrsFromContext(ctx context.Context) []any
- func Debug(msg string, args ...any)
- func DebugContext(ctx context.Context, msg string, args ...any)
- func Error(msg string, args ...any)
- func ErrorContext(ctx context.Context, msg string, args ...any)
- func Info(msg string, args ...any)
- func InfoContext(ctx context.Context, msg string, args ...any)
- func Log(ctx context.Context, level slog.Level, msg string, args ...any)
- func LogAttrs(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr)
- func NewAttrsContext(ctx context.Context, attrs ...any) context.Context
- func NewContext(ctx context.Context, logger *Logger) context.Context
- func SetDefault(log *Logger)
- func Warn(msg string, args ...any)
- func WarnContext(ctx context.Context, msg string, args ...any)
- type Logger
- func (logger *Logger) DebugContext(ctx context.Context, msg string, args ...any)
- func (logger *Logger) ErrorContext(ctx context.Context, msg string, args ...any)
- func (logger *Logger) InfoContext(ctx context.Context, msg string, args ...any)
- func (logger *Logger) Log(ctx context.Context, level slog.Level, msg string, args ...any)
- func (logger *Logger) LogAttrs(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr)
- func (logger *Logger) WarnContext(ctx context.Context, msg string, args ...any)
- func (logger *Logger) With(args ...any) *Logger
- func (logger *Logger) WithGroup(name string) *Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToContext ¶
AppendToContext append logging attributes to the given context.
func AttrsFromContext ¶
AttrsFromContext retrieve log attributes from context if any.
func DebugContext ¶
DebugContext calls Logger.DebugContext on the default logger.
func ErrorContext ¶
ErrorContext calls Logger.ErrorContext on the default logger.
func InfoContext ¶
InfoContext calls Logger.InfoContext on the default logger.
func NewAttrsContext ¶
NewAttrsContext return new logging attributes context.
func NewContext ¶
NewContext return new context with the given logger inside.
func SetDefault ¶
func SetDefault(log *Logger)
Types ¶
type Logger ¶
func FromContext ¶
FromContext return logger from the given context if exist
func (*Logger) DebugContext ¶
func (*Logger) ErrorContext ¶
func (*Logger) InfoContext ¶
func (*Logger) WarnContext ¶
Click to show internal directories.
Click to hide internal directories.