This PHP class was written as a light weight, easy-to-use way to log activity to a .log file. It's designed to instantly work within any PHP project, multiple log files and complete freedom with the format of the log entries.
Upon refreshing this page, the example log file in the above iframe is cleared and updated with new entries.
Create a log instance for one .log file, or multiple:
$log = new Log('example.log'); // OR $multi_logs = new Log(array( 'default' => 'example.log', 'other' => 'other.log' ));
Add entries to a .log file:
$log->warning('Basic entry, with timestamp'); $log->warning('Entry with context', array('Meta', 'data', 'here')); $log->log($log::DEBUG, 'Entry with custom level');
Clear the .log file completely (use with caution).