Commit 629ed629 by Qiang Xue

start debug logging only if debug runs when bootstrap.

parent a0636168
...@@ -71,8 +71,8 @@ class Module extends \yii\base\Module implements BootstrapInterface ...@@ -71,8 +71,8 @@ class Module extends \yii\base\Module implements BootstrapInterface
public function init() public function init()
{ {
parent::init(); parent::init();
$this->dataPath = Yii::getAlias($this->dataPath); $this->dataPath = Yii::getAlias($this->dataPath);
$this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
// merge custom panels and core panels so that they are ordered mainly by custom panels // merge custom panels and core panels so that they are ordered mainly by custom panels
if (empty($this->panels)) { if (empty($this->panels)) {
...@@ -99,6 +99,8 @@ class Module extends \yii\base\Module implements BootstrapInterface ...@@ -99,6 +99,8 @@ class Module extends \yii\base\Module implements BootstrapInterface
*/ */
public function bootstrap($app) public function bootstrap($app)
{ {
$this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
// delay attaching event handler to the view component after it is fully configured // delay attaching event handler to the view component after it is fully configured
$app->on(Application::EVENT_BEFORE_REQUEST, function () use ($app) { $app->on(Application::EVENT_BEFORE_REQUEST, function () use ($app) {
$app->getView()->on(View::EVENT_END_BODY, [$this, 'renderToolbar']); $app->getView()->on(View::EVENT_END_BODY, [$this, 'renderToolbar']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment