ConsoleSpanExporter
in package
implements
SpanExporterInterface
uses
UsesSpanConverterTrait, LogsMessagesTrait
Writes spans as human-readable JSON.
The output format is unspecified, is not OTLP and may change between releases. Use it for debugging and learning, not for parsing or as input to other tools.
Tags
Table of Contents
Interfaces
Properties
Methods
- __construct() : mixed
- export() : FutureInterface
- forceFlush() : bool
- getSpanConverter() : SpanConverterInterface
- shutdown() : bool
- convertSpan() : array<string|int, mixed>
- logDebug() : void
- logError() : void
- logInfo() : void
- logNotice() : void
- logWarning() : void
- setSpanConverter() : void
- doLog() : void
- Logging is best effort: a failing log writer (for example an error handler that throws on `trigger_error`) must not break the code that is being observed.
- shouldLog() : bool
Properties
$converter
private
SpanConverterInterface|null
$converter
= null
$transport read-only
private
TransportInterface
$transport
Methods
__construct()
public
__construct(TransportInterface $transport[, SpanConverterInterface|null $converter = null ]) : mixed
Parameters
- $transport : TransportInterface
- $converter : SpanConverterInterface|null = null
export()
public
export(iterable<string|int, mixed> $batch[, CancellationInterface|null $cancellation = null ]) : FutureInterface
Parameters
- $batch : iterable<string|int, mixed>
-
Batch of spans to export
- $cancellation : CancellationInterface|null = null
Attributes
- #[Override]
Return values
FutureInterfaceforceFlush()
public
forceFlush([CancellationInterface|null $cancellation = null ]) : bool
Parameters
- $cancellation : CancellationInterface|null = null
Attributes
- #[Override]
Return values
boolgetSpanConverter()
public
getSpanConverter() : SpanConverterInterface
Return values
SpanConverterInterfaceshutdown()
public
shutdown([CancellationInterface|null $cancellation = null ]) : bool
Parameters
- $cancellation : CancellationInterface|null = null
Attributes
- #[Override]
Return values
boolconvertSpan()
protected
convertSpan(SpanDataInterface $span) : array<string|int, mixed>
Parameters
- $span : SpanDataInterface
Tags
Return values
array<string|int, mixed>logDebug()
protected
static logDebug(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logError()
protected
static logError(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logInfo()
protected
static logInfo(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logNotice()
protected
static logNotice(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logWarning()
protected
static logWarning(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
setSpanConverter()
protected
setSpanConverter(SpanConverterInterface $converter) : void
Parameters
- $converter : SpanConverterInterface
doLog()
Logging is best effort: a failing log writer (for example an error handler that throws on `trigger_error`) must not break the code that is being observed.
private
static doLog(string $level, string $message, array<string|int, mixed> $context) : void
Parameters
- $level : string
- $message : string
- $context : array<string|int, mixed>
shouldLog()
private
static shouldLog(string $level) : bool
Parameters
- $level : string