Example #1
0
 function exception_error_handler($errno, $errstr, $errfile, $errline)
 {
     try {
         if (class_exists('Logger')) {
             $log = new \Fp\Log\Logger();
             $context = array('file' => $errfile, 'line' => $errline);
             $log->log($errno, $errstr, $context);
         } else {
             throw new \Exception($errstr, $errno);
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
Example #2
0
 protected function logError(\Exception $e)
 {
     print_r($e->getMessage());
     $log = new Logger();
     $log->notice('exception: ' . $e->getMessage(), array('exception' => $e));
 }
Example #3
0
 public function __call($name, $args)
 {
     try {
         $numArgs = count($args);
         $fn = "\\Fp\\Template\\TemplateDataMethod";
         // because direct call is ~~15x faster
         if ($numArgs < 1) {
             return $fn::$name($this);
         }
         if ($numArgs === 1) {
             return $fn::$name($this, $args[0]);
         }
         if ($numArgs === 2) {
             return $fn::$name($this, $args[0], $args[1]);
         }
         array_unshift($args, $this);
         return call_user_func_array($fn . '::' . $name, $args);
     } catch (\Exception $e) {
         $log = new Logger();
         $log->notice($e->getMessage(), array($e));
     }
 }