stevenrombauts/monolog-mdc

A Monolog processor to use mapped diagnostic context (MDC) with your logging

v2.0.0 2021-01-19 16:22 UTC

This package is auto-updated.

Last update: 2024-05-19 23:44:48 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.