Nexus API Reference

CallerInfoProcessor
in package
implements RecordProcessor

Read onlyYes
FinalYes
Tags
psalm-api

Captures the call site (class, function, file, line) at log-time and writes it into Record::$extra. Must run synchronously on the caller's thread — debug_backtrace() yields the actor's stack once the record is dequeued.

The processor walks the backtrace and skips frames belonging to PSR-3 scaffolding (Psr\Log, Monadial\Nexus\Logger\Logger, Monadial\Nexus\Logger\NexusLogger, this processor itself) so the first application frame is what lands in extra. This is more robust than a fixed depth across info() / debug() / log() / processor chains.

Output keys (all optional; only populated when present in the frame): class, function, file, line

Pair with a Monolog LineFormatter template like: "%channel%.%level_name% %extra.class%::%extra.function%:%extra.line% — %message%"

Table of Contents

Interfaces

RecordProcessor

Methods

__construct()  : mixed
onlyFor()  : self
Restrict the processor to the given levels. Equivalent to `new CallerInfoProcessor([Level::Debug, Level::Error])`.
process()  : Record

Methods

__construct()

public __construct([array<int, Level>|null $levels = null ]) : mixed
Parameters
$levels : array<int, Level>|null = null

null = run on every record. Pass a list to only walk the backtrace for matching levels — useful when you want call-site info on debug/error/critical but want to skip the debug_backtrace() cost on high-volume info-level messages.

onlyFor()

Restrict the processor to the given levels. Equivalent to `new CallerInfoProcessor([Level::Debug, Level::Error])`.

public static onlyFor(Level ...$levels) : self
Parameters
$levels : Level
Return values
self

        
On this page

Search results