PHP code example of mougrim / yii2-mougrim-logger

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

    

mougrim / yii2-mougrim-logger example snippets



use Mougrim\Logger\Logger as MougrimLogger;
use mougrim\yii2Logger\Logger;
use yii\log\Logger as YiiLogger;
...
// change standard logger class
\Yii::$container->set(
    YiiLogger::class,
    [
        'class' => Logger::class,
    ]
);
// configure Mougrim Logger
MougrimLogger::configure(__DIR__ . '/logger.php');
// your config
return [
    ....
];

\Yii::$container->set(
    YiiLogger::class,
    [
        'class' => Logger::class,
        'alwaysYiiLoggerLog' => true,
    ]
);