yii\base\Application::getLog PHP Method

getLog() public method

Returns the log dispatcher component.
public getLog ( ) : Dispatcher
return yii\log\Dispatcher the log dispatcher application component.
    public function getLog()
    {
        return $this->get('log');
    }

Usage Example

Beispiel #1
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * Adding routing rules and log target.
  * 
  * @param \yii\base\Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app instanceof WebApplication) {
         $app->getUrlManager()->addRules([new GroupUrlRule(['prefix' => 'podium', 'rules' => ['activate/<token:[\\w\\-]+>' => 'account/activate', 'admin/ban/<id:\\d+>' => 'admin/ban', 'admin/contents/<name:[\\w\\-]+>' => 'admin/contents', 'admin/delete/<id:\\d+>' => 'admin/delete', 'admin/delete-category/<id:\\d+>' => 'admin/delete-category', 'admin/delete-forum/<cid:\\d+>/<id:\\d+>' => 'admin/delete-forum', 'admin/edit-category/<id:\\d+>' => 'admin/edit-category', 'admin/edit-forum/<cid:\\d+>/<id:\\d+>' => 'admin/edit-forum', 'admin/forums/<cid:\\d+>' => 'admin/forums', 'admin/mod/<uid:\\d+>/<fid:\\d+>' => 'admin/mod', 'admin/mods/<id:\\d+>' => 'admin/mods', 'admin/new-forum/<cid:\\d+>' => 'admin/new-forum', 'admin/pm/<id:\\d+>' => 'admin/pm', 'admin/update/<id:\\d+>' => 'admin/update', 'admin/view/<id:\\d+>' => 'admin/view', 'admin' => 'admin/index', 'category/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/category', 'delete/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/delete', 'deletepost/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/deletepost', 'deleteposts/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/deleteposts', 'demote/<id:\\d+>' => 'admin/demote', 'edit/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/edit', 'forum/<cid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/forum', 'home' => 'default/index', 'install' => 'install/run', 'last/<id:\\d+>' => 'default/last', 'lock/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/lock', 'login' => 'account/login', 'logout' => 'profile/logout', 'members/posts/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/posts', 'members/threads/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/threads', 'members/view/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/view', 'members' => 'members/index', 'members/ignore/<id:\\d+>' => 'members/ignore', 'messages/delete/<id:\\d+>' => 'messages/delete', 'messages/new/<user:\\d+>' => 'messages/new', 'messages/reply/<id:\\d+>' => 'messages/reply', 'messages/view/<id:\\d+>' => 'messages/view', 'move/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/move', 'moveposts/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/moveposts', 'new-email/<token:[\\w\\-]+>' => 'account/new-email', 'new-thread/<cid:\\d+>/<fid:\\d+>' => 'default/new-thread', 'pin/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/pin', 'post/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/post', 'post/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>' => 'default/post', 'profile' => 'profile/index', 'profile/add/<id:\\d+>' => 'profile/add', 'profile/delete/<id:\\d+>' => 'profile/delete', 'profile/mark/<id:\\d+>' => 'profile/mark', 'promote/<id:\\d+>' => 'admin/promote', 'reactivate' => 'account/reactivate', 'register' => 'account/register', 'report/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>/<slug:[\\w\\-]+>' => 'default/report', 'reset' => 'account/reset', 'rss' => 'default/rss', 'search' => 'default/search', 'show/<id:\\d+>' => 'default/show', 'thread/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/thread']])], false);
         $dbTarget = new DbTarget();
         $dbTarget->logTable = '{{%podium_log}}';
         $dbTarget->categories = ['bizley\\podium\\*'];
         $dbTarget->logVars = [];
         $app->getLog()->targets['podium'] = $dbTarget;
     } elseif ($app instanceof ConsoleApplication) {
         $this->controllerNamespace = 'bizley\\podium\\console';
     }
 }