public function logException(Exception $e, $logger = null, $type = PhalconLogger::CRITICAL) { if (null === $logger) { $logger = Logger::messages(); } if (method_exists($logger, 'testMailing') && $logger->testMailing($e)) { $logger->mailException($e); } $this->log(sprintf('Exception %s %d: %s in %s:%d', get_class($e), $e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()), $logger, $type); }
public static function setErrorHandler() { set_error_handler(function ($errno, $errstr, $errfile, $errline) { switch ($errno) { case E_USER_NOTICE: case E_STRICT: break; default: \Logger::messages()->error(sprintf("Error: #%d %s at %s:%d", $errno, $errstr, $errfile, $errline)); } }); }
/** @return Logger_File */ public function getLogger() { return Logger::messages(); }