-
Notifications
You must be signed in to change notification settings - Fork 6
Log management
The Orm framework owns a minimalist Log system.
To see all the messages generated by the different modules you have to go inside the admin panel of the module Orm.
The first Dropdown will allow you to reduce/increase the number of messages generated. It does not influence the messages generated in the past.
In a production environment you should let the setting at INFO or WARN but not at DEBUG.
All the messages generated are written into a temp file : ./tmp/cache/orm.log
and you can clear the console by clicking on the second button Clean Log.
You don't need to refresh the page to see the new messages. It's automatic :)
You only need to know 4 functions :
OrmTRACE::debug('I am here !');
OrmTRACE::info('Everything was okay');
OrmTRACE::warn('Wrong parameter detected');
OrmTRACE::error('Boom... Head shoot !');
There is also another level between info and warn : OrmTRACE::sql('select * from table');
but its logically reserved to the inner system of ORM since you don't have to code the MySQL queries anymore ;)
if the level of debug selected in the admin panel of the module Orm is high enough, your message will be add to the others
Example : if my level of debug selected is WARN
OrmTRACE::debug('I am here !');
OrmTRACE::info('Everything was okay');
OrmTRACE::warn('Wrong parameter detected');
OrmTRACE::error('Boom... Head shoot !');
Will produce in the console :
yyyy-mm-dd hh:mm:ss - [WARN] - Wrong parameter detected
yyyy-mm-dd hh:mm:ss - [ERROR] - Boom... Head shoot !
Since the version 0.3.2 ORM will persist the last Queries in a custom stack. You can print these queries anytime you need (for debug)
//Display the lastest 5 queries for your debug
var_dump(OrmDb::getBufferQueries());
You can also set a different size for this stack (5 by default) simply coding OrmDb::setBufferLength(20);
before executing your own code.