PHP code example of blogdaren / logger

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

    

blogdaren / logger example snippets



ogger\Logger;

while(1)
{
    usleep(500000);
    Logger::info('with INFO level');
    Logger::debug('with DEBUG level');
    Logger::warn('with WARNING level');
    Logger::error('with ERROR level');
    Logger::crazy('with CRAZY level');
}

* $arg1: message to be logged
* $arg2: log level with 5 options: 
  >> Logger::LOG_LEVEL_INFO
  >> Logger::LOG_LEVEL_DEBUG
  >> Logger::LOG_LEVEL_WARN
  >> Logger::LOG_LEVEL_ERROR
  >> Logger::LOG_LEVEL_CRAZY
* $arg3: determine whether to print log or not, default `NULL`.
* $arg4: where to store log file, default `''`, u can keep it empty then will do nothing.