1. Go to this page and download the library: Download enlitepro/enlite-monolog library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
enlitepro / enlite-monolog example snippets
// usage over service locator
$serviceLocator->get('EnliteMonologService')->debug('hello world');
use EnliteMonolog\Service\MonologServiceAwareInterface,
EnliteMonolog\Service\MonologServiceAwareTrait;
// usage in your services
class MyService implements MonologServiceAwareInterface
{
use MonologServiceAwareTrait;
public function whatever()
{
$this->getMonologService()->debug('hello world');
}
}
'EnliteMonolog' => array(
'EnliteMonologService' => array(
// Logger name
// 'name' => 'EnliteMonolog',
// Handlers, it can be service locator alias(string) or config(array)
'handlers' => array(
// by config
'default' => array(
'name' => 'Monolog\Handler\StreamHandler',
'args' => array(
'stream' => 'data/log/application.log',
'level' => \Monolog\Logger::DEBUG,
'bubble' => true
),
'formatter' => array(
'name' => 'Monolog\Formatter\LogstashFormatter',
'args' => array(
'applicationName' => 'My Application',
),
),
),
// by service locator
'MyMonologHandler'
)
),
// you can specify another logger
// for example ChromePHPHandler
'MyChromeLogger' => array(
'name' => 'MyName',
'handlers' => array(
array(
'name' => 'Monolog\Handler\ChromePHPHandler',
)
)
)
),