logging

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package logging configures process-wide log output from the log config block. The text format keeps the historical plain lines. The json format writes one JSON object per line to stdout for container log collectors: standard-library log lines, slog records, HTTP access logs and GORM logs all go through the same handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessLog

func AccessLog() gin.HandlerFunc

AccessLog is the json replacement for gin.Logger: one record per request.

func JSON

func JSON() bool

JSON reports whether the json format is active.

func Setup

func Setup(cfg config.LogConfig)

Setup applies cfg to the process. It must run before the HTTP router and the database are initialised, so they pick up the chosen format.

func SetupTo

func SetupTo(cfg config.LogConfig, out io.Writer)

SetupTo is Setup with an explicit destination, for tests.

func StdWriter

func StdWriter() io.Writer

StdWriter returns a writer that turns each written line into an INFO record of the active JSON handler, regardless of the configured level.

Types

This section is empty.

Jump to

Keyboard shortcuts

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