gluephp/glue-monolog

Use monolog logger in Glue

0.1.0 2016-05-06 19:38 UTC

This package is not auto-updated.

Last update: 2024-05-20 05:06:21 UTC


README

Use Monolog with gluephp/glue

Installation

Use Composer:

$ composer require gluephp/glue-monolog

Configure Monolog

$app = new Glue\App;

$app->config->override([
    'monolog' => [
        'folder'    => '/absolute/path/to/log/folder',
        'file'      => 'log_' . date('Ymd') . '.log',
        'level'     => 'error' // PSR-3 logging level
    ],
]);

Register Monolog

$app->register(
    new Glue\Monolog\ServiceProvider()
);

Get the Monolog instance

Once the service provider is registered, you can fetch the Monolog instance with:

$monolog = $app->make('Monolog\Logger');

or since Monolog implements the PSR interface:

$monolog = $app->make('Psr\Log\LoggerInterface');

or use the alias:

$monolog = $app->log;