Capabilities ​
@anvia/logger has two responsibilities: provide small structured-logger implementations and translate Anvia observer events into log records.
Logger implementations ​
| Factory | Best for | Output |
|---|---|---|
createConsoleLogger() | Development and simple runtimes | One JSON string per record via console.log (or a custom writer) |
createPinoLogger() | Structured production logging | Pino JSON records |
Both support trace, debug, info, warn, error, fatal, and child(bindings).
Observer events ​
The observer records:
- Run start, completion (always with the final assistant text), failure, usage, and message count.
- Generation start, completion, failure, provider, model, usage, and first-delta timing.
- Tool start, stream events, completion, failure, and skipped status.
- Trace, user, session, turn, and call identifiers when the runtime provides them.
Tool arguments are recorded on tool start, and the run-end record always includes the final assistant text. The typed structured output, full generation requests and responses, and tool results require explicit capture flags.
Boundaries ​
The package does not rotate files, ship logs, sample events, redact arbitrary values, or configure a vendor backend. Configure those concerns in Pino, the destination transport, or your hosting platform. It is a logging adapter, not a tracing backend: use OpenTelemetry when parent-child spans and distributed trace correlation are required.