Console Transport
The console transport is the simplest transport in Ambiten Logger and is primarily intended for local development, active debugging, runtime visibility, and immediate operational feedback during execution.
Although the output appears as console text, the transport still participates in the same structured runtime pipeline used by every other transport in the system.
import {
createLogger,
consoleTransport
} from '@ambiten/logger';
const logger = createLogger({
transports: [
consoleTransport()
]
});When a runtime event is emitted, the transport formats the structured runtime entry into a console-friendly representation before writing it to the process output stream.
logger.info('Server started');Example output:
[2026-05-14T15:10:02.112Z] - [INFO] Server startedConceptually:
Structured Runtime Event
↓
Console Formatting
↓
Terminal OutputThe runtime event remains structured internally even though the final output appears human-readable.
Colorized runtime visibility
The console transport supports optional colorized output to improve readability during active development sessions
consoleTransport(true);Severity levels become visually distinguishable through terminal colors so warnings, errors, traces, and informational runtime events remain easier to identify during debugging.
Conceptually:
info → informational visibility
warn → highlighted caution
error → critical visibility
trace → low-level runtime flowColorization can also be disabled explicitly.
consoleTransport(false);This is useful in environments where ANSI terminal colors may introduce formatting artifacts or interfere with downstream log collection systems.
Structured runtime metadata
The console transport integrates naturally with structured runtime metadata.
logger.warn('Rate limit threshold reached', {
tenantId: 'tenant-eu',
activeRequests: 120
});Because the transport operates on normalized runtime entries internally, structured metadata remains preserved throughout the formatting process.
The transport simply controls presentation. It does not flatten or destroy runtime structure.
Conceptually:
Runtime Metadata
↓
Structured Runtime Event
↓
Console PresentationThis allows development-oriented console visibility while still preserving operational structure internally.
JSON console output
When JSON logging is enabled, the console transport emits serialized structured runtime entries instead of formatted text output.
const logger = createLogger({
json: true,
transports: [
consoleTransport()
]
});Example output:
{
"timestamp": "2026-05-14T15:14:01.442Z",
"level": "warn",
"message": "Rate limit threshold reached",
"meta": {
"tenantId": "tenant-eu",
"activeRequests": 120
}
}This allows console output to participate directly in structured observability workflows while still remaining immediately visible during execution.
The runtime event structure remains unchanged regardless of formatting mode.
Context-aware console logging
Because the transport operates on normalized runtime entries, context-aware metadata inherited from AmbitenContext remains preserved automatically.
{
"requestId": "req_82AB",
"tenantId": "tenant-us"
}This allows developers to observe runtime continuity directly from terminal output during development, debugging, transactional execution, or request tracing.
Conceptually:
Execution Context
↓
Structured Runtime Event
↓
Console VisibilityOperational metadata remains attached automatically throughout execution flow.
Relationship with production observability
Although console logging is extremely useful during development, it is generally insufficient as the sole production transport in larger systems.
Console streams alone typically do not provide:
persistent storage
retention management
delivery guarantees
batching
compression
remote ingestion
resilience handlingdepending on the runtime environment and deployment model.
Production systems therefore commonly combine console visibility with persistent or remote transports.
const logger = createLogger({
transports: [
consoleTransport(),
createRotatingFileTransporter({
filename: './logs/runtime.log'
})
]
});Conceptually:
Console Transport → immediate runtime visibility
Persistent Transport → operational retention
Remote Transport → centralized observabilityEach transport serves a different operational responsibility.
Runtime-oriented development visibility
The console transport exists primarily as a runtime visibility layer for developers and operators during active execution.
It allows runtime activity to remain immediately observable while the broader transport system handles persistence, buffering, batching, resilience, retention, and remote observability integration downstream.
The transport is intentionally lightweight because its primary purpose is fast runtime visibility rather than long-term telemetry management.
Summary
The console transport provides immediate runtime visibility through formatted terminal output while still participating fully in Ambiten Logger’s structured runtime pipeline.
Structured runtime events remain normalized internally, contextual execution metadata propagates automatically, JSON output remains supported, and console visibility integrates naturally alongside persistent and remote observability transports without changing application logging behavior.
