PHP code example of vagrus / monolog-yii-ar-handler

1. Go to this page and download the library: Download vagrus/monolog-yii-ar-handler 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/ */

    

vagrus / monolog-yii-ar-handler example snippets




use Monolog\Logger;
use Vagrus\Monolog\Handler\YiiArHandler;

$mappingSettings = array(
    '*' => 'modelProperty', // :WARNING));

// add records to the log
$log->warning('Foo');



use Monolog\Logger;
use Vagrus\Monolog\Handler\YiiArHandler;

$mappingSettings = array(
    '*' => 'property1', // 
$log->pushHandler(new YiiArHandler('modelName', $mappingSettings, Logger::WARNING));

// add records to the log
// 'Foo' will be written to model's property1, 'some context value' to property2, etc. 
$context = array(
    'contextVar1' => 'some context value',
    'contextVar2' => 'other context value',
);
$log->warning('Foo', $context);