PHP code example of websvc / php-monolog-wrapper

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

    

websvc / php-monolog-wrapper example snippets



$log = new websvc/php-monolog-wrapper('logger-name', [
            'logFile' => '/tmp/mylog.log',
            'loggerLevel'=> 'DEBUG',    // Set logging level
            'toStderr'=> true           // Log output to stderr
        ]);

$log->addLog('INFO', "My info message ", ["a call identifier"]);
$log->addLog('DEBUG', "My debug message ", ["a call identifier"]);
$log->addLog('ERROR', "My error message ", ["a call identifier"]);


function myFunction(){

    global $log;

    echo "Hello World!";

    $log->addLog('DEBUG', "Function was called! ", [__FUNCTION__]);

}


bash
composer