PHP code example of ext / logger

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

    

ext / logger example snippets


use Zeus\Logger;

$logger = new Logger([
  'name' => 'zeus',
  'max' => 0,
  'permission' => 0644,
  'path' => '',
  'lock' => false,
  'level' => Level::Debug,
  'processors' => [],
  'handlers' => [],
  'timezone' => 'Asia/Shanghai',
  'output_format' => "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n",
  'date_format' => RotatingFileHandler::FILE_PER_DAY,
  'file_format' => "{filename}-{date}"
]);

$logger->info("Hello World", ['foo' => 'bar']);
$logger->debug("Hello World", ['foo' => 'bar']);
$logger->notice("Hello World", ['foo' => 'bar']);
$logger->warning("Hello World", ['foo' => 'bar']);
$logger->error("Hello World", ['foo' => 'bar']);
$logger->critical("Hello World", ['foo' => 'bar']);
$logger->alert("Hello World", ['foo' => 'bar']);
$logger->emergency("Hello World", ['foo' => 'bar']);