The Logger class is a utility for writing log messages to different types of log drivers. It supports logging to a database or a file, depending on the specified log driver.
The class checks if logging is enabled via configuration settings and handles exceptions by falling back to file logging if database logging fails.
Is composed by several levels:
Log_Level::ERROR
Log_Level::WARNING
Log_Level::FAILURE
Log_Level::INFORMATION
Log_Level::SUCCESS
Log_Level::CRONJOB
There are two types of log types:
Log_Driver:FILE
Log_Driver:DATABASE
//Logger::write($message, $level, $type) Logger::write("Write example Error text in file", Log_Level::ERROR, Log_Driver::FILE); Logger::write("Write example Info text in database", Log_Level::INFORMATION, Log_Driver::DATABASE);
You can also use Log_Database_List
class to view list of your log.
$logList = new Log_Database_List(); $logList->loadAll("id", "desc"); print_r($logList->items);
public static function write($message = "", $level = Log_Level::INFORMATION, $type = Log_Driver::DATABASE)
void
: No return value.