PHP code example of wxxiong6 / wxxlogger

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

    

wxxiong6 / wxxlogger example snippets


    use wxxiong6\wxxLogger\Logger;
    $config = [
      'defaultTemplate' = '%T|%L|%P|%I|%Q|%C',
      'logPath' => __DIR__.'/runtime/logs',
      'maxLogFiles' => 5,
      'traceLevel'  => 0,
      'maxFileSize' => 10240,
      'logFile'     => 'app.log',
      'levels'      => ['error','warning', 'info','debug'],
    ];
    Logger::getInstance()->setConfig($config);

    // 单个属性修改可以如用如下方法
    Logger::getInstance()->setDefaultTemplate('%T|%L|%P|%I|%Q|%C');
    Logger::getInstance()->setXXX($val);

    Logger::error(['mes'=>'error','code'=>100], '123123');
    Logger::debug('debug');
    Logger::info('debug');

Logger::debug('debug');

Logger::info('info');

Logger::error('error');