add logger to application controller
This commit is contained in:
parent
e03b45c25b
commit
ad815e4c99
1 changed files with 24 additions and 0 deletions
|
|
@ -25,6 +25,13 @@
|
|||
* @var array
|
||||
*/
|
||||
public $components = array('auth');
|
||||
|
||||
/**
|
||||
* Logger instance
|
||||
*
|
||||
* @var Logger
|
||||
*/
|
||||
protected $log = null;
|
||||
/**
|
||||
* Linker instance
|
||||
*
|
||||
|
|
@ -50,6 +57,9 @@
|
|||
public function __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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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