Nexus API Reference

MonologHandlerAdapter
in package
implements Handler

Read onlyYes
FinalYes
Tags
psalm-api

Drops any Monolog HandlerInterface into the nexus-logger pipeline.

Each nexus Record is converted to a Monolog LogRecord, then forwarded to the wrapped handler. Because nexus-logger's actor invokes Handler::handle on its own turn (not the caller's), the wrapped Monolog handler's I/O cost stays off the request path.

Usage:

use Monolog\Handler\RotatingFileHandler; use Monolog\Handler\SyslogHandler;

NexusLogger::create($system, 'app') ->handler(new MonologHandlerAdapter(new RotatingFileHandler('/var/log/app.log', 7))) ->handler(new MonologHandlerAdapter(new SyslogHandler('app'))) ->build();

Soft-depends on monolog/monolog ^3.0; install separately when used.

Table of Contents

Interfaces

Handler

Methods

__construct()  : mixed
handle()  : void

Methods

__construct()

public __construct(HandlerInterface $delegate[, array<int, callable(LogRecord): LogRecord$processors = [] ]) : mixed
Parameters
$delegate : HandlerInterface
$processors : array<int, callable(LogRecord): LogRecord> = []

Monolog processors applied to the converted LogRecord before the delegate handler runs. Use this to attach Monolog's stock processors (HostnameProcessor, ProcessIdProcessor, MemoryUsageProcessor, GitProcessor, etc.) — they would otherwise be skipped because we bypass Monolog\Logger. All Monolog processors implement ProcessorInterface (an __invoke contract), so they're callable.


        
On this page

Search results