ConsoleExporter implements Exporter
Read onlyYes
FinalYes
Unified console exporter for logs, metrics, and spans.
Outputs telemetry to the console in human-readable formatted tables with optional ANSI colors. Dispatches on batch type and renders accordingly.
Interfaces
- Exporter
- Interface for exporting telemetry signals to external systems.
Methods
- __construct() : mixed
- export() : bool
- Export a signal batch.
- shutdown() : void
- Shutdown the exporter and any owned transports.
Methods
__construct()
public
__construct([bool $colors = true ][, null|int $maxLogBodyLength = null ][, null|resource $outputStream = null ][, ConsoleLogOptions $logOptions = new ConsoleLogOptions() ][, ConsoleMetricOptions $metricOptions = new ConsoleMetricOptions() ][, ConsoleSpanOptions $spanOptions = new ConsoleSpanOptions() ]) : mixed
Parameters
- $colors : bool = true
-
Whether to use ANSI colors
- $maxLogBodyLength : null|int = null
-
Maximum length for log body+attributes column (null = no limit)
- $outputStream : null|resource = null
-
Output stream (default: STDOUT)
- $logOptions : ConsoleLogOptions = new ConsoleLogOptions()
- $metricOptions : ConsoleMetricOptions = new ConsoleMetricOptions()
- $spanOptions : ConsoleSpanOptions = new ConsoleSpanOptions()
export()
Export a signal batch.
public
export(Signals $signal) : bool
Implementations dispatch on Signal::$type via match.
Parameters
- $signal : Signals
Return values
bool —True on success, false on failure
shutdown()
Shutdown the exporter and any owned transports.
public
shutdown() : void
Implementations MUST be idempotent and MUST NOT throw - runtime errors are routed through the configured error handler instead.