ginlog

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ginlog traces and logs the requests a gin server answers, with the logs set up by the telemetry package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogAttrs

func LogAttrs(ctx *gin.Context, attrs ...slog.Attr)

LogAttrs adds attrs, such as the signed-in user's id, to the records written with the request's context from now on, and to the line the request is logged with

func Middleware

func Middleware(
	serviceName string,
	public bool,
	levels telemetry.RequestLevels,
	onPanic func(*gin.Context),
) []gin.HandlerFunc

Middleware returns the middleware that traces each request and logs it at the level for how it ended. When public is set, the trace id a caller sends is ignored and each request starts its own trace. onPanic answers a request whose handler panicked, after the panic is logged, unless the handler had started its answer; a plain 500 when nil.

func RequestID

func RequestID(ctx *gin.Context, requestID string)

RequestID adds the request's id to its logs, as request_id

Types

This section is empty.

Jump to

Keyboard shortcuts

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