BatchLogRecordProcessor
in package
implements
LogRecordProcessorInterface
uses
LogsMessagesTrait
Table of Contents
Interfaces
Constants
- DEFAULT_EXPORT_TIMEOUT : mixed = 30000
- DEFAULT_MAX_EXPORT_BATCH_SIZE : mixed = 512
- DEFAULT_MAX_QUEUE_SIZE : mixed = 2048
- DEFAULT_SCHEDULE_DELAY : mixed = 1000
Properties
- $autoFlush : bool
- $batch : array<int, ReadWriteLogRecord>
- $batchId : int
- $clock : ClockInterface
- $closed : bool
- $exportContext : ContextInterface
- $exporter : LogRecordExporterInterface
- $exporterAttributes : array<non-empty-string, string>
- $flush : SplQueue<string|int, ContextInterface}>
- $logExportedCounter : CounterInterface|null
- $logInflightCounter : UpDownCounterInterface|null
- $logProcessedCounter : CounterInterface|null
- $maxExportBatchSize : int
- $maxQueueSize : int
- $nextScheduledRun : int|null
- $processorAttributes : array<non-empty-string, string>
- $queue : SplQueue<string|int, array<int, ReadWriteLogRecord>>
- $queueSize : int
- $running : bool
- $scheduledDelayNanos : int
Methods
- __construct() : mixed
- forceFlush() : bool
- onEmit() : void
- shutdown() : bool
- logDebug() : void
- logError() : void
- logInfo() : void
- logNotice() : void
- logWarning() : 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.
- enqueueBatch() : void
- flush() : bool
- shouldFlush() : bool
- shouldLog() : bool
Constants
DEFAULT_EXPORT_TIMEOUT
public
mixed
DEFAULT_EXPORT_TIMEOUT
= 30000
DEFAULT_MAX_EXPORT_BATCH_SIZE
public
mixed
DEFAULT_MAX_EXPORT_BATCH_SIZE
= 512
DEFAULT_MAX_QUEUE_SIZE
public
mixed
DEFAULT_MAX_QUEUE_SIZE
= 2048
DEFAULT_SCHEDULE_DELAY
public
mixed
DEFAULT_SCHEDULE_DELAY
= 1000
Properties
$autoFlush read-only
private
bool
$autoFlush
= true
$batch
private
array<int, ReadWriteLogRecord>
$batch
= []
$batchId
private
int
$batchId
= 0
$clock read-only
private
ClockInterface
$clock
$closed
private
bool
$closed
= false
$exportContext
private
ContextInterface
$exportContext
$exporter read-only
private
LogRecordExporterInterface
$exporter
$exporterAttributes read-only
private
array<non-empty-string, string>
$exporterAttributes
$flush
private
SplQueue<string|int, ContextInterface}>
$flush
$logExportedCounter read-only
private
CounterInterface|null
$logExportedCounter
$logInflightCounter read-only
private
UpDownCounterInterface|null
$logInflightCounter
$logProcessedCounter read-only
private
CounterInterface|null
$logProcessedCounter
$maxExportBatchSize
private
int
$maxExportBatchSize
$maxQueueSize
private
int
$maxQueueSize
$nextScheduledRun
private
int|null
$nextScheduledRun
= null
$processorAttributes read-only
private
array<non-empty-string, string>
$processorAttributes
$queue
private
SplQueue<string|int, array<int, ReadWriteLogRecord>>
$queue
$queueSize
private
int
$queueSize
= 0
$running
private
bool
$running
= false
$scheduledDelayNanos
private
int
$scheduledDelayNanos
Methods
__construct()
public
__construct(LogRecordExporterInterface $exporter, ClockInterface $clock[, int $maxQueueSize = self::DEFAULT_MAX_QUEUE_SIZE ][, int $scheduledDelayMillis = self::DEFAULT_SCHEDULE_DELAY ][, int $exportTimeoutMillis = self::DEFAULT_EXPORT_TIMEOUT ][, int $maxExportBatchSize = self::DEFAULT_MAX_EXPORT_BATCH_SIZE ][, bool $autoFlush = true ][, MeterProviderInterface|null $meterProvider = null ]) : mixed
Parameters
- $exporter : LogRecordExporterInterface
- $clock : ClockInterface
- $maxQueueSize : int = self::DEFAULT_MAX_QUEUE_SIZE
- $scheduledDelayMillis : int = self::DEFAULT_SCHEDULE_DELAY
- $exportTimeoutMillis : int = self::DEFAULT_EXPORT_TIMEOUT
- $maxExportBatchSize : int = self::DEFAULT_MAX_EXPORT_BATCH_SIZE
- $autoFlush : bool = true
- $meterProvider : MeterProviderInterface|null = null
forceFlush()
public
forceFlush([CancellationInterface|null $cancellation = null ]) : bool
Parameters
- $cancellation : CancellationInterface|null = null
Attributes
- #[Override]
Return values
boolonEmit()
public
onEmit(ReadWriteLogRecord $record[, ContextInterface|null $context = null ]) : void
Parameters
- $record : ReadWriteLogRecord
- $context : ContextInterface|null = null
Attributes
- #[Override]
shutdown()
public
shutdown([CancellationInterface|null $cancellation = null ]) : bool
Parameters
- $cancellation : CancellationInterface|null = null
Attributes
- #[Override]
Return values
boollogDebug()
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> = []
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>
enqueueBatch()
private
enqueueBatch() : void
flush()
private
flush([string|null $flushMethod = null ][, CancellationInterface|null $cancellation = null ]) : bool
Parameters
- $flushMethod : string|null = null
- $cancellation : CancellationInterface|null = null
Return values
boolshouldFlush()
private
shouldFlush() : bool
Return values
boolshouldLog()
private
static shouldLog(string $level) : bool
Parameters
- $level : string