logfiber

package module
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 7 Imported by: 0

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

func Middleware(cfg Config) fiber.Handler

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.

Jump to

Keyboard shortcuts

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