Logger is a simple PHP class that allows logging various types of messages to a database table. In order to use Logger you'll need to create the database table for it. In order to do this you need to import the SQL in phptools/logger/logger.sql into a database of your choosing this will create the necessary table structure. Then it needs to have access to the database object, this must be a an instance of the DB class that's included with phptools. In order to do this you must set a callback on the Logger object you can see an example of this below.
Once Logger has a database object then it can do it's thing. There are four types of log messages debug, info, warn, and error. Each of these has it's own method which are described below.
Logs the output of debug_backtrace() for debugging purposes. In order to prevent from logging debug messages in higher environments debug will not log anything unless you set the debug flag by calling setDebug(true), you can turn it off by calling the same method with false as the parameter.
Used to log error messages,
Used to log informational messages,
Turn debug mode on or off. It gets set to the boolean conversion of
Used to log warning messages,