logger

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package logger provides a standardized structured logger for the IPAM backend. Logs to stdout with consistent keys and message formats.

Index

Constants

View Source
const (
	KeyPath          = "path"
	KeyMethod        = "method"
	KeyStatus        = "status"
	KeyDuration      = "duration_ms"
	KeyError         = "error"
	KeyUserID        = "user_id"
	KeyEmail         = "email"
	KeyOperation     = "operation"
	KeySetupRequired = "setup_required"
)

Standard keys for structured logs (consistent across the backend).

View Source
const (
	MsgSetupStatusFailed     = "setup status check failed"
	MsgSetupAlreadyDone      = "setup already completed"
	MsgSetupMissingCreds     = "email and password required"
	MsgSetupPasswordFailed   = "password setup failed"
	MsgSetupCreateUserFailed = "failed to create user"
	MsgAuthMissingCreds      = "email and password required"
	MsgAuthInvalidCreds      = "invalid email or password"
	MsgAuthPasswordMismatch  = "password mismatch"
	MsgStoreError            = "store error"
)

Standard error messages (consistent, non-PII where possible).

Variables

Functions

func ErrAttr

func ErrAttr(err error) slog.Attr

ErrAttr returns slog.Any(KeyError, err) or a no-op if err is nil.

func Error

func Error(msg string, args ...any)

Error logs at Error level with optional key-value pairs.

func Info

func Info(msg string, args ...any)

Info logs at Info level with optional key-value pairs.

func Request

func Request(method, path string, status int, durationMs int64)

Request logs a completed HTTP request (method, path, status, duration_ms).

func Warn

func Warn(msg string, args ...any)

Warn logs at Warn level with optional key-value pairs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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