add logger to application controller

This commit is contained in:
coderkun 2014-05-25 22:14:05 +02:00
commit ad815e4c99

View file

@ -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);
}
}
?>