PHP code example of lf4php / lf4php-monolog

1. Go to this page and download the library: Download lf4php/lf4php-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/ */

    

lf4php / lf4php-monolog example snippets



// configuring monolog loggers
$monolog1 = new \Monolog\Logger('foo');
$monolog2 = new \Monolog\Logger('bar');

// registering them for lf4php
$loggerFactory = StaticLoggerBinder::$SINGLETON->getLoggerFactory();
$loggerFactory->setRootMonologLogger($monolog1);
$loggerFactory->registerMonologLogger($monolog2);


$logger = LoggerFactory::getLogger(__CLASS__);
$logger->info('Message');
$logger->debug('Hello {}!', array('John'));
$logger->error(new \Exception());