/** * replace internal katadebug-function */ function kataDebugOutput($var = null, $isTable = false) { formaldehyde_log('debug', $var); }
/** * last action to execute * * Both error handler and shutdown function could try to output something. * This could happen specially with Fatal and other unexpected errors. * To avoid problems, both functions will call this exit one * which is flagged to be executed only once. * * This function performs these tasks: * 1 - set X-Formaldehyde-Log header with optional logs * 2 - set X-Formaldehyde header with elapsed time * 3 - set output buffer with the error, or the noraml output * * @param bool error occurred. If true, overwrite the output buffer with JSON string. * @param string buffer to wrap or the JSON object * @param mixed if true set buffer return to true. * @return string empty string or stored buffer. */ function formaldehyde_exit($stop, $string, $return) { static $execute = true; if ($execute) { $execute = false; @header('X-Formaldehyde-Log: ' . formaldehyde_encode(formaldehyde_remove_recursion(formaldehyde_log()))); @header('X-Formaldehyde: ' . round(formaldehyde_time(), 6)); formaldehyde_buffer($stop, $string, $return); } }