trace

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 5 Imported by: 7

Documentation

Overview

Pacakge trace implements a trace logging HTTP request middleware handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTraceID

func GetTraceID(ctx context.Context) string

GetTraceID returns the trace ID from ctx.

func NewTraceLoggingHandler

func NewTraceLoggingHandler(next http.Handler, logger log.Logger, traceIDFn func(*http.Request) string) http.HandlerFunc

NewTraceLoggingHandler logs HTTP request details and sets up trace logging. The host, method, URL path, user agent are immediately logged. The "x_forwarded_for" header is also logged if present. The "trace_id" key will be set on the context logger and logged if traceIDFn is set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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