PHP code example of bephp / logger

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

    

bephp / logger example snippets



gger is active based on truthiness of an expression
$debug = logger('./debug.log', getenv('PHP_ENV') === 'TEST');
$debug('This will show up if PHP_ENV is set to TEST');

# logger is active based result of callable
$info = logger('./info.log', function () {
  return true;
});
$info('This should show up');

# works like printf
$name = 'noodlehaus';
$info('Hello there %s', $name);

# defaults
$always = logger('./file.log');
$always('This always gets logged.');