|
|
|
Buggy uses its own database abstraction that you can change to allow store all queries used in the system in database.
First you should include db2.class.php and buggy.class.php
then initialize the Buggy object :
// 3 for Debug level - 0 production system
Buggy::_init(3);
Then start the Buggy system in the beginning of the code :
Buggy::StartScript();
This will log the event "Begin script execution" in the database and start a timer wich will give the total time execution of the script.
Then put this before last code executed in script
Buggy::EndScript();
This will store the time used by the buggy's queries and the "End of script execution" event in database.
To log any other event in your code you can use for example :
Buggy::logMessage('AbstractDB', 'Begin', $query);
Buggy::SetMicroTime('AbstractDB');
Where AbstractDB is the module, "Begin" is the event and $query the current executed query for example. then we can set a timer named "AbstractDB". After running the query we can get the time used with GetExecutionTime() and log the Event "End" for the AbstractDB module :
$time = Buggy::GetExecutionTime('AbstractDB');
Buggy::logMessage('AbstractDB', 'End', "Query done",$time);
Buggy log also all PHP errors in database.
You can read from the buggy table in database or just create a small web tool to create reports from it.
Any question or comment are welcomed.
Hatem
http://phptunisie.net |
|
| The class to check load time of your script
VERY usefull for relatively slow applications, but not only.. Categories : PHP, PHP Classes, Debugging | | | A time measuring and performance benchmarking class Categories : PHP, PHP Classes, Testing, Debugging, Date Time | | | A Custom Error Handling And Debugging Class Categories : PHP, PHP Classes, Debugging, Errors and Logging | | | [PHP5] PHP Debugger and Helper Categories : PHP, PHP Classes, Errors and Logging, Debugging, XML | | | very simple ftp class Categories : PHP, PHP Classes, FTP | | | PHP Paypal IPN Integration Class v1.0.0 Categories : PHP, PHP Classes, Payment Gateways | | | A Timing Class Categories : PHP, PHP Classes, Date Time | | | Create HTML forms dynamicly using Javascript & PHP Categories : PHP, PHP Classes, Java Script | | | PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP | | | usercounter class Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables | | | RSS parser.
Parses RSS into an array. Quick and nasty but does the job.
No checking is done for correct Tags, only correct XML.
PHP4 needed to display result (uses print_r). Categories : PHP, XML, PHP Classes, Rich Site Summary (RSS) | | | ElfReader: An ELF (Executable and Linking Format) header information in PHP. Shows how to use the UNPACK function to read data. Categories : PHP, Linux, PHP Classes | | | an example of the cyberlib payment class Categories : PHP, PHP Classes, Ecommerce, Credit Cards | | | Power Form Validation Categories : PHP, PHP Classes, Data Validation | | | MySQL Handler Categories : PHP, Databases, MySQL, Classes and Objects, PHP Classes | |
|
|
|