add logger to application controller
This commit is contained in:
parent
4883e78792
commit
e97a4822df
1 changed files with 24 additions and 0 deletions
|
|
@ -25,6 +25,13 @@
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $components = array('auth');
|
public $components = array('auth');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logger instance
|
||||||
|
*
|
||||||
|
* @var Logger
|
||||||
|
*/
|
||||||
|
protected $log = null;
|
||||||
/**
|
/**
|
||||||
* Linker instance
|
* Linker instance
|
||||||
*
|
*
|
||||||
|
|
@ -50,6 +57,9 @@
|
||||||
public function __construct($layoutName, $action, $agent)
|
public function __construct($layoutName, $action, $agent)
|
||||||
{
|
{
|
||||||
parent::__construct($layoutName, $action, $agent);
|
parent::__construct($layoutName, $action, $agent);
|
||||||
|
|
||||||
|
// Create logger
|
||||||
|
$this->log = new \nre\core\Logger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -102,6 +112,20 @@
|
||||||
parent::postFilter($request, $response);
|
parent::postFilter($request, $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log an error.
|
||||||
|
*
|
||||||
|
* @param string $message Error message to log
|
||||||
|
* @param int $logMode Log mode (optional)
|
||||||
|
*/
|
||||||
|
protected function log($message, $logMode=\nre\core\Logger::LOGMODE_AUTO)
|
||||||
|
{
|
||||||
|
$this->log->log($message, $logMode);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue