PHP code example of sgoettsch / monolog-rotating-file-handler

1. Go to this page and download the library: Download sgoettsch/monolog-rotating-file-handler 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/ */

    

sgoettsch / monolog-rotating-file-handler example snippets




use sgoettsch\MonologRotatingFileHandler\Handler\MonologRotatingFileHandler;
use Monolog\Logger;

// path to log file
$filename = 'app.log';

// Instantiate handler
$handler = new MonologRotatingFileHandler($filename);

// Create a log channel
$log = new Logger('name');

// Set handler
$log->pushHandler($handler);

// Add records to the log
$log->debug('Foo');
$log->warning('Bar');
$log->error('Baz');