golazy.dev
–
golazy.dev
/
lazytelemetry
/
lazylogs
Index
|
Files
package lazylogs ¶
import "golazy.dev/lazytelemetry/lazylogs"
Functions ¶
func Debug ¶
Debug logs a debug message.
func Debug(ctx context.Context, message string, attrs ...slog.Attr)
func Error ¶
Error logs an error message.
func Error(ctx context.Context, message string, attrs ...slog.Attr)
func Info ¶
Info logs an info message.
func Info(ctx context.Context, message string, attrs ...slog.Attr)
func LogAttrs ¶
LogAttrs logs with the context logger and records the message as a span event when ctx has an active span.
func LogAttrs(ctx context.Context, level slog.Level, message string, attrs ...slog.Attr)
func Logger ¶
Logger returns the logger attached to ctx, or slog.Default when none exists.
func Logger(ctx context.Context) *slog.Logger
func NewJSONLogger ¶
NewJSONLogger returns a slog logger that writes JSON records.
func NewJSONLogger(out io.Writer) *slog.Logger
func NewTextLogger ¶
NewTextLogger returns a slog logger that writes text records.
func NewTextLogger(out io.Writer) *slog.Logger
func Warn ¶
Warn logs a warning message.
func Warn(ctx context.Context, message string, attrs ...slog.Attr)
func WithAttrs ¶
WithAttrs returns a context whose logger includes attrs.
func WithAttrs(ctx context.Context, attrs ...slog.Attr) context.Context
func WithGroup ¶
WithGroup returns a context whose logger writes subsequent attrs in group.
func WithGroup(ctx context.Context, group string) context.Context
func WithLogger ¶
WithLogger attaches logger to ctx.
func WithLogger(ctx context.Context, logger *slog.Logger) context.Context
func WithTags ¶
WithTags returns a context whose logger includes the given tags.
func WithTags(ctx context.Context, tags ...string) context.Context
Package lazylogs provides slog-compatible context logging helpers.