slog

command
v1.1.69 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Example: using gologger as a log/slog handler.

gologger.DefaultLogger implements slog.Handler, so you can route the standard library's structured logger through gologger's CLI output without giving up the gologger.* fluent API. This example walks through the main slog integration points:

  1. Drop-in handler via slog.SetDefault
  2. Custom gologger levels usable from slog.Log(ctx, ...)
  3. All slog attribute kinds
  4. WithGroup flattening and WithAttrs persistence
  5. Mixing slog.* and gologger.* in the same program
  6. TrimGologgerLevels for clean level names in JSON/Text handlers

Jump to

Keyboard shortcuts

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