stevenrombauts / monolog-mdc
A Monolog processor to use mapped diagnostic context (MDC) with your logging
v2.0.0
2021-01-19 16:22 UTC
Requires
- php: >=7.3.0
- monolog/monolog: ^2.0
This package is auto-updated.
Last update: 2026-03-02 14:54:04 UTC
README
A Monolog processor to use mapped diagnostic context (MDC) with your logging. This enables you to store key-values pair that will be injected into the context of all your subsequent Monolog logs.
Usage
Install with Composer:
composer require stevenrombauts/monolog-mdc
Add the processor to your Monolog instance and use as follows:
<?php use Stevenrombauts\MonologMDC; $logger = new Monolog\Logger('mdc'); $logger->pushProcessor(new MDCProcessor()); MDC::add('foo', 'bar');
The foo=bar key-value pair will be included in all subsequent logs.