mumsnet/mn-monolog

Custom handlers for Monolog

v1.0.4 2020-08-07 09:04 UTC

This package is auto-updated.

Last update: 2024-04-07 17:52:13 UTC


README

Custom handlers for Monolog

How to use with Lumen

Add this to your composer.json file in the require section:

"mumsnet/mn-monolog": "^1.0"

Run composer to update the packages:

docker run -it -v `pwd`:/var/www/html mumsnet/php-fpm-lumen:7.3 composer install

Add this to your bootstrap/app.php file:

if (getenv('PAPERTRAIL_HOSTNAME') !== FALSE) {
    $app->configureMonologUsing(function ($monolog) {
        $papertrailHandler = new PapertrailHandler(
            getenv('PAPERTRAIL_HOSTNAME'),
            getenv('PAPERTRAIL_PORT'),
            getenv('SITE_HOSTNAME'),
            getenv('PAPERTRAIL_PROGRAM_NAME'));
        $monolog->pushHandler($papertrailHandler);
        return $monolog;
    });
}