Laravel tap for Monolog processors

1.0.1 2019-03-17 08:54 UTC


Processor tap enables you to easily specify Monolog processors which will add information to your log record.

Log::info('Hello world!'); // [2019-01-01 12:00:00] local.INFO: Hello world! {"memory_usage":"16 MB","uid":"e44d60c"}


Processor tap works with Laravel versions that support the logging taps (5.6+) .


composer require lukam/monolog-tap


Simply add the provided MonologTap\MonologProcessors tap to a logging channel.

To specify the processors, add a comma-separated list of processor names as the tap attribute.

'single' => [
    'driver' => 'single',
    'path' => storage_path('logs/laravel.log'),
    'level' => 'debug',
    'tap' => ['MonologTap\MonologProcessors:uid,memory_usage']

The processor name is the snake_name of the Monolog's processor class without the processor suffix. (e.g. uid refers to the UidProcessor and memory_usage to the MemoryUsageProcessor).

Supported processors

Processor Description
git Injects Git branch and Git commit SHA in all records
introspection Injects line/file:class/function where the log message came from
memory_peak_usage Injects memory_get_peak_usage in all records
memory_usage Injects memory_get_usage in all records
mercurial Injects Hg branch and Hg revision number in all records
process_id Adds value of getmypid into records
psr_log_message Processes a record's message according to PSR-3 rules
uid Adds a unique identifier into records
web Injects url/method and remote IP of the current web request in all records




The MIT License (MIT). See the license file for more information.