Documentation
¶
Overview ¶
Package logging defines the repo-owned, backend-neutral logging contract used throughout github.com/amikos-tech/ami-gin.
Contract ¶
The Logger interface is intentionally context-free: it does not accept or store a context.Context. Callers own trace correlation externally. The library never injects trace IDs, span IDs, or request IDs into log output.
Adapter Split ¶
The core logging package has no backend dependency. Callers who want to route log output to a specific backend import the appropriate sub-package:
- logging/slogadapter — adapts *slog.Logger
- logging/stdadapter — adapts *log.Logger
Importing logging alone does not pull either adapter into the build graph.
Safe-Metadata Restrictions ¶
INFO-level log attributes are limited to the frozen allowlist:
- operation — coarse operation name (e.g. "evaluate", "encode")
- predicate_op — operator kind (e.g. "EQ", "GT")
- path_mode — bounded enum: "exact", "bloom-only", "adaptive-hybrid"
- status — outcome: "ok" or "error"
- error.type — normalized error category; unknown values collapse to "other"
Predicate values, field path names, document IDs, row-group IDs, term IDs, and any raw user content must never appear in INFO-level log attributes. Those details may appear only in trace events or behind a LevelDebug guard.
Index ¶
Constants ¶
const ( PathModeExact = "exact" PathModeBloomOnly = "bloom-only" PathModeAdaptiveHybrid = "adaptive-hybrid" )
Bounded path_mode values. Query evaluation uses PathMode.String() which maps to one of these labels only. Tests should enforce both the key list and the bounded value set.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug emits a debug-level message. It guards on Enabled before calling Log, avoiding backend dispatch work when debug is disabled.
Types ¶
type Attr ¶
Attr is a typed key-value pair used by the repo-owned logging contract. The typed surface (rather than variadic any) lets the compiler enforce the frozen vocabulary: callers must construct attrs through the named helpers below rather than passing raw strings or dynamic values.
func AttrErrorType ¶
AttrErrorType returns an error.type attr using the frozen key. Unknown kinds collapse to "other".
func AttrOperation ¶
AttrOperation returns an operation attr using the frozen key.
func AttrPathMode ¶
AttrPathMode returns a path_mode attr using the frozen key. Callers must use one of the PathMode* constants as the value.
func AttrPredicateOp ¶
AttrPredicateOp returns a predicate_op attr using the frozen key.
func AttrStatus ¶
AttrStatus returns a status attr using the frozen key.
type Logger ¶
Logger is the repo-owned backend-neutral logging contract. Implementations must be safe for concurrent use. The contract is intentionally context-free: callers manage trace correlation externally; the logger never injects trace IDs or span IDs into log output.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package slogadapter wires log/slog into the repo-owned logging contract.
|
Package slogadapter wires log/slog into the repo-owned logging contract. |
|
Package stdadapter wires the stdlib *log.Logger into the repo-owned logging contract.
|
Package stdadapter wires the stdlib *log.Logger into the repo-owned logging contract. |