Login   Register  
PHP Classes

File: dtest.phtml

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of creep  >  debugger  >  dtest.phtml  >  Download  
File: dtest.phtml
Role: ???
Content type: text/plain
Description: example of how to use debugger class
Class: debugger
give you debug messages with verbose levels
Author: By
Last change:
Date: 2002-04-23 07:50
Size: 1,991 bytes


Class file image Download
<body onLoad="document.forms[0].num.focus();">

<font face='arial,helvetica,sans serif' size=2>

<table width=500 align=center><tr><td><font face='arial,helvetica,sans serif' size=2>
When you put debug messages in your code, you should mark them as level 0 if they are very important.
If they are only notices or not very important, mark them with a higher number. The debug class will show you 
all debug messages that are marked with a number less than the reporting threshhold you enter in the box below.

<form action=<?=$PHP_SELF;?> method=get>

<b>Enter debug verbosity level you want (0-10):</b> <input type=text size=2 name=num>
<input type=submit value=Enter><br>
<i>Entering zero squelches out more messages<br>
   Entering a high number lets you see more messages</i>


$num = intval($num);

$dbg = new debug ();

$dbg->add_message("0 could be a panic debug message - for something fatal", 0, __LINE__, "/bla/". basename(__FILE__));
$dbg->add_message("2 could be a debug message for something important", 2, __LINE__, "/bla/". basename(__FILE__));
$dbg->add_message("4 could be debug message for something like a warning", 4, __LINE__, "/bla/". basename(__FILE__));
$dbg->add_message("debug level 4 message without line number or filename", 4);
$dbg->add_message("6 could be a warning or mere notice", 6, __LINE__, "/bla/". basename(__FILE__));
$dbg->add_message("8 could be a message you may not always care to hear", 8, __LINE__, "/bla/". basename(__FILE__));
$dbg->add_message("10 could be a message you want to keep quiet most of the
time", 10, __LINE__, "/bla/". basename(__FILE__));
$dbg->add_message("debug level 10 message without the filename", 10, __LINE__);


<a href=dtest.phps>Source code</a>, this file<br>
<a href=debugger.phps>Source code</a>, debugger.php