|
|
|
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 Custom Error Handling And Debugging Class Categories : PHP, PHP Classes, Debugging, Errors and Logging | | | A time measuring and performance benchmarking class Categories : PHP, PHP Classes, Testing, Debugging, Date Time | |
| | phpFormGenerator for Dynamic Form Generation from MySQL Categories : PHP, PHP Classes, MySQL, Databases, HTML and PHP | | | Example Shopping cart class Categories : Ecommerce, PHP, PHP Classes | | | PHPDRAW, the php wannabe Photoshop ;-) Categories : PHP, PHP Classes, GD image library, Arrays | | | simple shopping cart for php3 Categories : PHP, PHP Classes, Complete Programs, Ecommerce | | | [PHP5] NOTIMEOUT PACKAGE Categories : PHP, PHP Classes, AJAX | | | Generate HTML Calendar of a month of year Categories : PHP, Calendar, PHP Classes | | | SQLite PHP Database Wrapper Categories : PHP, PHP Classes, Databases, SQLite, Beginner Guides | | | HTTP gzip compression Categories : PHP, PHP Classes, Compression, Zlib | | | PHPShell - A class implementing a shell written in PHP Categories : PHP, PHP Classes, CLI | | | Render TTF Text to PNG. Text message, font, size, rotation, padding, color, background, and transparency can all be defined via URL. Categories : PHP, PHP Classes, Graphics | | | Excel class in PHP Categories : PHP, PHP Classes, Excel | |
|
|