PHP code example of chiron / logger

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

    

chiron / logger example snippets



// you can define minimal login level (ex : ERROR) if you add a second parameter, by default all the levels are logged
$logger = new Chiron\Logger('./' . 'logger_'. date('Y-m-d') .'.log');
$logger->log('error',  'Example error text' );

//Multilines + replace value beetween "{}"
$logger->log('error',  'Line 1 : {TXT}', array('TXT' => null) ); // empty
$logger->log('error',  'Line 2 : {TXT}', array('TXT' => 'toto') ); // string
$logger->log('error',  'Line 3 : {TXT}', array('TXT' => 1234) ); // integer
$logger->log('error',  'Line 4 : {TXT}', array('TXT' => date(\DateTime::RFC3339) ) ); // object date

$logger->info('info text !');
$logger->notice('notice text !');

$logger->warning('Warning text : {TXT}', array('TXT' => 'Hector' ) );