Documentation
¶
Overview ¶
Package logfiber is the Fiber v2 adapter for the logcore structured logger. It exposes a middleware that emits one "incoming" log entry per request with the standard req/res/responseTime schema (matching the outgoing logs produced by logcore.HTTPClientHook).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
Middleware returns a Fiber v2 handler that emits one structured log per request after the handler chain runs. The log uses the transaction's ctx (c.Context()), so trace.id/transaction.id are attached automatically when apmfiber.Middleware ran first.
Types ¶
type Config ¶
type Config struct {
// SkipPaths lists request paths that bypass logging entirely
// (probes, healthchecks). Compared with exact string equality.
// Default: ["/live", "/ready", "/health"].
SkipPaths []string
// SkipFunc, when non-nil, is called for every request that was not
// already skipped by SkipPaths. Returning true suppresses the log
// entry. Use this for method-, pattern- or prefix-based skip rules:
//
// cfg.SkipFunc = func(method, path string) bool {
// return method == "OPTIONS" || strings.HasPrefix(path, "/internal/")
// }
SkipFunc func(method, path string) bool
// Logger overrides the global logcore logger. Nil → use the global.
Logger *logcore.Logger
}
Config tunes the middleware. All fields are optional.
Click to show internal directories.
Click to hide internal directories.