PHP code example of noodlehaus / logger

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

    

noodlehaus / logger example snippets



e default priority = LOG_ERR and prefix map
$log = logger('./app.log');
$log(LOG_INFO, 'Application started.');
$log(LOG_NOTICE, 'Hostname is %s', 'foo');
$log(LOG_DEBUG, '1 + 1 is 2');
$log(LOG_ERR, 'OMG something went wrong!');

# more verbose logging, change some entry prefixes
$debug = logger('./app.log', LOG_DEBUG, [
  LOG_DEBUG => 'LOOK_AT_THIS'
]);

$debug(LOG_ERR, 'OMG the server is on fire!');
$debug(LOG_DEBUG, 'We should check if the server is on fire');