mougrim / yii2-mougrim-logger
Port mougrim/php-logger to Yii2
Installs: 37
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.5.0
- mougrim/php-logger: 2.*
- yiisoft/yii2: 2.*
Requires (Dev)
- phpunit/phpunit: 4.*
This package is auto-updated.
Last update: 2024-08-29 17:28:55 UTC
README
If you want to maintain it, you can make a fork.
Mougrim logger port Extension for Yii 2
This extension provides using mougrim/php-logger (ex Mitallast Logger) in Yii 2 Framework.
This extension provides all logs expects profiling logs.
Benefits
mougrim/php-logger has next benefits:
- flexible configuration;
- interface like Apache log4php (with debug log level);
- higher than yii2 logger performance.
For more information and benchmark result see benefits.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist mougrim/yii2-mougrim-logger
or add
"mougrim/yii2-mougrim-logger": "*"
to the require
section of your composer.json, then run php composer.phar update
Configuration
To use this extension, you have to configure Logger in your application configuration:
<?php 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 [ .... ];
For configuration Mougrim Logger see documentation mougrim/php-logger.
If you want use Mougrim Logger and Yii Logger together, change your config:
\Yii::$container->set( YiiLogger::class, [ 'class' => Logger::class, 'alwaysYiiLoggerLog' => true, ] );
May be you want use this way for correct working of debug panel.