diff --git a/ChromePhp.php b/ChromePhp.php index 577b1ce..e6c536c 100755 --- a/ChromePhp.php +++ b/ChromePhp.php @@ -185,6 +185,29 @@ public static function error() return self::_log(self::ERROR, $args); } + /** + * logs an exception to the console + * + * @param Exception|Error $ex + * @return void + */ + public static function exception($ex) + { + if (!($ex instanceof Exception) && !($ex instanceof Error)) { + return self::error($ex); + } + + $type = self::ERROR; + $logger = self::getInstance(); + $logger->_processed = array(); + + $logs = array(); + $logs[] = $ex->getMessage(); + $backtrace_message = $ex->getFile() . ' : ' . $ex->getLine(); + + $logger->_addRow($logs, $backtrace_message, $type); + } + /** * sends a group log *