PHP code example of seablast / logger

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

    

seablast / logger example snippets


use Seablast\Logger\Logger;
$conf = array(
    // THESE ARE THE DEFAULT SETTINGS
    // 0 = send message to PHP's system logger; recommended is however 3, i.e. append to the file destination set in the field 'logging_file'
    Logger::CONF_ERROR_LOG_MESSAGE_TYPE => 0,
    // if error_log_message_type equals 3, the message is appended to this file destination (path and name)
    Logger::CONF_LOGGING_FILE => '',
    // verbosity: log up to the level set here, default=5 = debug
    Logger::CONF_LOGGING_LEVEL => 5,
    // rename or renumber, if needed
    Logger::CONF_LOGGING_LEVEL_NAME => array(0 => 'unknown', 1 => 'fatal', 'error', 'warning', 'info', 'debug', 'speed'),
    // the logging level to which the page generation speed (i.e. error_number 6) is to be logged
    Logger::CONF_LOGGING_LEVEL_PAGE_SPEED => 5,
    // false => use logging_file with log extension as destination; true => adds .Y-m.log to the logging file
    Logger::CONF_LOG_MONTHLY_ROTATION => true,
    // prefix message that took longer than profiling step (float) sec from the previous one by SLOWSTEP
    Logger::CONF_LOG_PROFILING_STEP => false,
    // fatal error may just be written in log, on production, it is however recommended to set an e-mail, where to announce fatal errors
    Logger::CONF_MAIL_FOR_ADMIN_ENABLED => false,
);
$logger = new Logger($conf);

$logger = new \Seablast\Logger\Logger();
$tracyLogger = new \Tracy\Bridges\Psr\PsrToTracyLoggerAdapter($logger);
Debugger::setLogger($tracyLogger);
Debugger::enable();