PHP code example of piotrpress / logger

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

    

piotrpress / logger example snippets




use PiotrPress\Logger;
use PiotrPress\Logger\FileHandler;
use PiotrPress\Logger\ErrorLogHandler;

$logger = new Logger(
    new FileHandler( __DIR__ . '/' . date( 'Y-m-d' ) . '.log' ),
    new ErrorLogHandler() 
);
    
$logger->error( '[{module}] Example error', [ 'module' => 'Core' ] );