Documentation ¶
Index ¶
- Constants
- type TracingHandler
- func (h *TracingHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (h *TracingHandler) Handle(ctx context.Context, r slog.Record) error
- func (h *TracingHandler) Handler() slog.Handler
- func (h *TracingHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *TracingHandler) WithGroup(name string) slog.Handler
Constants ¶
const SpanIDKey = "span_id"
The line `const SpanIDKey = "span_id"` is declaring a constant variable named `SpanIDKey` with the value `"span_id"`. This constant is used as a key to add an attribute to a log record.
const TraceIDKey = "trace_id"
The `const TraceIDKey = "trace_id"` line is declaring a constant variable named `TraceIDKey` with the value `"trace_id"`. This constant is used as a key to add an attribute to a log record.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TracingHandler ¶
type TracingHandler struct {
// contains filtered or unexported fields
}
The TracingHandler type is a wrapper around a slog.Handler. @property handler - The `handler` property is a variable of type `slog.Handler`.
func NewTracingHandler ¶
func NewTracingHandler(h slog.Handler) *TracingHandler
The function NewTracingHandler creates a new TracingHandler by wrapping an existing slog.Handler.
func (*TracingHandler) Enabled ¶
The `Enabled` method is a function defined on the `TracingHandler` struct. It takes two parameters: `ctx` of type `context.Context` and `level` of type `slog.Level`.
func (*TracingHandler) Handle ¶
The `Handle` method is a function defined on the `TracingHandler` struct. It takes two parameters: `ctx` of type `context.Context` and `r` of type `slog.Record`.
func (*TracingHandler) Handler ¶
func (h *TracingHandler) Handler() slog.Handler
Handler returns the Handler wrapped by h.
func (*TracingHandler) WithAttrs ¶
func (h *TracingHandler) WithAttrs(attrs []slog.Attr) slog.Handler
The `func (h *TracingHandler) WithAttrs(attrs []slog.Attr) slog.Handler` method is a function defined on the `TracingHandler` struct. It takes a parameter `attrs` of type `[]slog.Attr`, which represents a list of log attributes.
func (*TracingHandler) WithGroup ¶
func (h *TracingHandler) WithGroup(name string) slog.Handler
The `func (h *TracingHandler) WithGroup(name string) slog.Handler {` method is defining a function on the `TracingHandler` struct. This function takes a parameter `name` of type `string`, which represents the name of the log group.