lukam/monolog-tap

Laravel tap for Monolog processors

1.0.1 2019-03-17 08:54 UTC

This package is auto-updated.

Last update: 2024-11-17 21:15:44 UTC


README

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"}

Requirements

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

Installation

composer require lukam/monolog-tap

Usage

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

Testing

phpunit

License

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