Esempio n. 1
0
 /**
  * Constructs a new Database Logger.
  *
  * @param array $options Options for the DatabaseLogger
  */
 public function __construct($options = array())
 {
     $options += array('model' => 'Log');
     if (empty(self::$_model)) {
         App::uses('AppModel', 'Model');
         App::uses($options['model'], 'Model');
         self::$_model = new $options['model']();
     }
 }
Esempio n. 2
0
 /**
  * write log into logfile
  * @return void
  */
 protected static function getHandler()
 {
     if (is_resource(self::$handler)) {
         return self::$handler;
     } else {
         self::$handler = fopen(self::getFilename(), "a");
     }
     if (!is_resource(self::$handler)) {
         throw new Exception("Cannot open logfile.");
     }
     return self::$handler;
 }