PHP code example of razonyang / yii2-psr-log

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

    

razonyang / yii2-psr-log example snippets


$categoryParam = '__CATEGORY__';

$logger = new \RazonYang\Yii2\Psr\Log\Logger($categoryParam);
$logger->error('hello {name}', [$categoryParam => __METHOD__, 'name' => 'foo']);
// equals to
Yii::error('hello foo', __METHOD__);