stevenrombauts/monolog-mdc

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

Maintainers

Package info

github.com/stevenrombauts/monolog-mdc

pkg:composer/stevenrombauts/monolog-mdc

Statistics

Installs: 31 188

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

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

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.