diff --git a/src/include/functions_debugoutput.php b/src/include/functions_debugoutput.php new file mode 100644 index 0000000..472aa67 --- /dev/null +++ b/src/include/functions_debugoutput.php @@ -0,0 +1,198 @@ + www.phplogcon.org <- * + * ----------------------------------------------------------------- * + * Helperfunctions to print debug info + * + * -> + * + * All directives are explained within this file + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ + +// --- Avoid directly accessing this file! +if ( !defined('IN_PHPLOGCON') ) +{ + die('Hacking attempt'); + exit; +} +// --- + +function CreateHTMLHeader() +{ + global $RUNMODE, $content, $gl_root_path; + + + // not needed in console mode + if ( $RUNMODE == RUNMODE_COMMANDLINE ) + return; + + global $currentclass, $currentmenuclass; + $currentclass = "line0"; + $currentmenuclass = "cellmenu1"; + + print (' + + + + + + + +
+ '); +} + +function PrintDebugInfoHeader() +{ + global $RUNMODE; + global $currentmenuclass; + + if ( $RUNMODE == RUNMODE_COMMANDLINE ) + print ( "Num.\tFacility . \tDebug Message\n" ); + else if ( $RUNMODE == RUNMODE_WEBSERVER ) + { + print(' + + + + + + +
NumberDebugLevelFacilityDebugMessage
'); + } +} + +function PrintHTMLDebugInfo( $facility, $fromwhere, $szDbgInfo ) +{ + global $content, $currentclass, $currentmenuclass, $gldbgcounter, $DEBUGMODE, $RUNMODE; + + // No output in this case + if ( $facility > $DEBUGMODE ) + return; + + if ( !isset($gldbgcounter) ) + $gldbgcounter = 0; + $gldbgcounter++; + + if ( $RUNMODE == RUNMODE_COMMANDLINE ) + print ( $gldbgcounter . ". \t" . GetFacilityAsString($facility) . ". \t" . $fromwhere . ". \t" . $szDbgInfo . "\n" ); + else if ( $RUNMODE == RUNMODE_WEBSERVER ) + { + print (' + + + + + + +
' . $gldbgcounter . '' . GetFacilityAsString($facility) . '' . $fromwhere . '  ' . $szDbgInfo . '
'); + + // Set StyleSheetclasses + if ( $currentclass == "line0" ) + $currentclass = "line1"; + else + $currentclass = "line0"; + if ( $currentmenuclass == "cellmenu1" ) + $currentmenuclass = "cellmenu2"; + else + $currentmenuclass = "cellmenu1"; + } + + //Flush output + FlushHtmlOutput(); +} + +function GetFacilityAsString( $facility ) +{ + switch ( $facility ) + { + case DEBUG_ULTRADEBUG: + return STR_DEBUG_ULTRADEBUG; + case DEBUG_DEBUG: + return STR_DEBUG_DEBUG; + case DEBUG_INFO: + return STR_DEBUG_INFO; + case DEBUG_WARN: + return STR_DEBUG_WARN; + case DEBUG_ERROR: + return STR_DEBUG_ERROR; + case DEBUG_ERROR_WTF: + return STR_DEBUG_ERROR_WTF; + } + + // reach here = unknown + return "*Unknown*"; +} + +function GetDebugClassFacilityAsString( $facility ) +{ + switch ( $facility ) + { + case DEBUG_ULTRADEBUG: + return "debugultradebug"; + case DEBUG_DEBUG: + return "debugdebug"; + case DEBUG_INFO: + return "debuginfo"; + case DEBUG_WARN: + return "debugwarn"; + case DEBUG_ERROR: + return "debugerror"; + case DEBUG_ERROR_WTF: + return "debugerrorwtf"; + } + + // reach here = unknown + return "*Unknown*"; +} + +function CreateHTMLFooter() +{ + global $content, $ParserStart, $RUNMODE; + $RenderTime = number_format( microtime_float() - $ParserStart, 4, '.', ''); + + // not needed in console mode + if ( $RUNMODE == RUNMODE_COMMANDLINE ) + return; + + print ('

Finished

+ Total running time was ' . $RenderTime . ' seconds +

+
+
+ + '); +} + + +?> \ No newline at end of file