/** * Get a single line of text representing the exception: * * Error [ Code ]: Message ~ File [ Line ] * * @param object Exception * @return string */ public static function text($e) { return sprintf('%s [ %s ]: %s ~ %s [ %d ]' . "\n\n" . '%s' . "\n\n", get_class($e), $e->getCode(), strip_tags($e->getMessage()), Eight_Exception::debug_path($e->getFile()), $e->getLine(), Eight_Exception::trace_string($e->getTrace())); }
/** * Get a single line of text representing the exception: * * Error [ Code ]: Message ~ File [ Line ] * * @param object Exception * @return string */ public static function text($e, $full_args = FALSE) { // Should we use the full argument length or truncate? $arg_char_limit = $full_args ? 2500 : 50; // Clean up the message a bit $message = str_replace(array("<br>", "<br/>", "<br />", "\r\n", "\n", "\r"), '; ', strip_tags($e->getMessage())); // How was the request made $called = 'Request:' . "\n"; $method = strtoupper(request::method()); if ($method == 'CLI') { $called .= 'CLI - ' . cli::launch_cmd(); } else { $called .= '[' . $method . '] ' . request::ip() . ' - ' . request::protocol() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if (is_array($_POST) && count($_POST) > 0) { $called .= "\n\nBody:\n"; $called .= var_export($_POST, TRUE); } } return sprintf('%s [ %s ]: %s ~ %s [ %d ]' . "\n\n" . '%s' . "\n\n" . '%s' . "\n", get_class($e), $e->getCode(), $message, Eight_Exception::debug_path($e->getFile()), $e->getLine(), $called, Eight_Exception::trace_string($e->getTrace(), $arg_char_limit)); }