logutil

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Overview

Package logutil provides small helpers for structured logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Level

func Level(s string) slog.Level

Level maps a string to slog.Level. Unknown values default to Info. Accepts (case-insensitive): "debug", "info", "warn", "warning", "error".

func SafeField

func SafeField(s string) string

SafeField strips C0 control characters and DEL from s, returning a string safe to include as a structured log field value. Use it to wrap any field derived from HTTP input (paths, headers, query strings, error messages carrying user data) before passing to slog, to prevent log forging via embedded newlines or terminal escape sequences.

Types

This section is empty.

Jump to

Keyboard shortcuts

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