Monolog for Glue
Use Monolog with gluephp/glue, (*1)
Installation
Use Composer:, (*2)
$ composer require gluephp/glue-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:, (*3)
$monolog = $app->make('Monolog\Logger');
or since Monolog implements the PSR interface:, (*4)
$monolog = $app->make('Psr\Log\LoggerInterface');
or use the alias:, (*5)
$monolog = $app->log;