@anvia/logger ​
@anvia/logger provides structured logging implementations and an agent observer that translates runtime activity into log records.
Install ​
pnpm add @anvia/core @anvia/loggerLog an agent run ​
import { Agent } from '@anvia/core'
import { createConsoleLogger, createLoggerObserver } from '@anvia/logger'
const logger = createConsoleLogger({
level: 'info',
name: 'support-agent',
})
const agent = new Agent({
id: 'support',
model: model,
observability: {
observers: { logger: createLoggerObserver({ logger }) },
},
})Use createPinoLogger when the application already uses Pino or needs a custom destination stream. Use logger.child() to attach stable request, tenant, or service fields without rebuilding them for every call.
Capture policy ​
The run-end record always includes the final assistant text. Full payloads — the typed structured output, model requests and responses, and tool results — stay out of logs unless their capture flags are enabled. Treat those flags as a data-governance decision: payloads can contain prompts, secrets, or personal data.
Features ​
- Console and Pino-backed structured loggers.
- Consistent trace through fatal log levels.
- Child loggers with inherited bindings.
- Agent observer integration.
- Independent controls for requests, responses, output, and tool results.
Compatibility ​
The package is a server-side logging adapter and declares @anvia/core as a peer dependency. Pino is included as a runtime dependency.