slog

package
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
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.

View Source
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

func (h *TracingHandler) Enabled(ctx context.Context, level slog.Level) bool

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

func (h *TracingHandler) Handle(ctx context.Context, r slog.Record) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL