|
From: <rd...@us...> - 2009-02-04 12:22:17
|
Revision: 1972
http://digir.svn.sourceforge.net/digir/?rev=1972&view=rev
Author: rdg
Date: 2009-02-04 12:11:56 +0000 (Wed, 04 Feb 2009)
Log Message:
-----------
New TP_DIAG_LEVEL option controls diagnostic messages display.
Modified Paths:
--------------
tapirlink/trunk/classes/TpDiagnostics.php
tapirlink/trunk/www/localconfig_dist.php
tapirlink/trunk/www/tapir_errors.php
tapirlink/trunk/www/tapir_globals.php
Modified: tapirlink/trunk/classes/TpDiagnostics.php
===================================================================
--- tapirlink/trunk/classes/TpDiagnostics.php 2009-02-04 12:10:35 UTC (rev 1971)
+++ tapirlink/trunk/classes/TpDiagnostics.php 2009-02-04 12:11:56 UTC (rev 1972)
@@ -22,6 +22,7 @@
*
*/
+require_once(dirname(__FILE__).'/../www/tapir_globals.php');
// tapir_diagnostics.php is generated by applying diag_codes_php.xslt
// against diag_codes.xml
require_once(dirname(__FILE__).'/../www/tapir_diagnostics.php');
@@ -58,6 +59,24 @@
*/
function Append( $cd, $msg, $severity )
{
+ if ( $severity == DIAG_WARN and TP_DIAG_LEVEL > 2 )
+ {
+ return;
+ }
+
+ if ( $severity == DIAG_INFO and TP_DIAG_LEVEL > 1 )
+ {
+ return;
+ }
+
+ if ( $severity == DIAG_DEBUG and TP_DIAG_LEVEL > 0 )
+ {
+ return;
+ }
+
+ global $g_dlog;
+ $g_dlog->debug("Appending ".$severity." when level is ".TP_DIAG_LEVEL);
+
$stack =& TpDiagnostics::_GetStack();
array_push( $stack, new TpDiagnostic( $cd, $msg, $severity ) );
Modified: tapirlink/trunk/www/localconfig_dist.php
===================================================================
--- tapirlink/trunk/www/localconfig_dist.php 2009-02-04 12:10:35 UTC (rev 1971)
+++ tapirlink/trunk/www/localconfig_dist.php 2009-02-04 12:11:56 UTC (rev 1972)
@@ -56,6 +56,14 @@
*/
//define('TP_LOG_LEVEL', PEAR_LOG_INFO);
+/*
+* Indicate the minimum level of diagnostic messages to appear in responses.
+* Options are: 0 (DEBUG), 1 (INFO), 2 (WARN), 3 (ERROR)
+* Setting 1 (INFO) will avoid debug diagnostics, setting 2 (WARN) will avoid
+* info and debug diagnostics, and so on. Deafult is 1 (INFO).
+*/
+//define( 'TP_DIAG_LEVEL', 3 );
+
/**
* Set this true to allow incoming debug requests
* (not recommended for stable installations).
Modified: tapirlink/trunk/www/tapir_errors.php
===================================================================
--- tapirlink/trunk/www/tapir_errors.php 2009-02-04 12:10:35 UTC (rev 1971)
+++ tapirlink/trunk/www/tapir_errors.php 2009-02-04 12:11:56 UTC (rev 1972)
@@ -57,16 +57,12 @@
case DIAG_ERROR:
- TpDiagnostics::Append( "Error [$errNo]",
- $errStr,
- DIAG_ERROR );
+ TpDiagnostics::Append( "Error [$errNo]", $errStr, DIAG_ERROR );
break;
case DIAG_WARN:
- TpDiagnostics::Append( "Warning [$errNo]",
- $errStr,
- DIAG_WARN );
+ TpDiagnostics::Append( "Warning [$errNo]", $errStr, DIAG_WARN );
break;
default:
Modified: tapirlink/trunk/www/tapir_globals.php
===================================================================
--- tapirlink/trunk/www/tapir_globals.php 2009-02-04 12:10:35 UTC (rev 1971)
+++ tapirlink/trunk/www/tapir_globals.php 2009-02-04 12:11:56 UTC (rev 1972)
@@ -437,6 +437,17 @@
}
/*
+* Indicate the minimum level of diagnostic messages to appear in responses.
+* Options are: 0 (DEBUG), 1 (INFO), 2 (WARN), 3 (ERROR)
+* Setting 1 (INFO) will avoid debug diagnostics, setting 2 (WARN) will avoid
+* info and debug diagnostics, and so on.
+*/
+if ( ! defined( 'TP_DIAG_LEVEL' ) )
+{
+ define( 'TP_DIAG_LEVEL', 1 );
+}
+
+/*
* Set to true if you want to track statistics
*/
if ( ! defined( 'TP_STATISTICS_TRACKING' ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|