Overview
I needed a very simple and easy to use logging class for some PHP scripts I develop/maintain. I found a very straight forward approach on Chris Valleriani blog (here: http://chrisvall.com/coding/php-easy-to-use-logging-class-for-your-scripts). PHP_logging_basics.md
Setup
Just add Logger.php
to your project.
Usage
<?php
require('Logger.php');
/* ... */
// init
$log = new Logger('YourLogName');
// add log entry
$log->logWrite('Starting...');
Other minor improvements
- Move base dir to constructor args;
- Create archiving option to compress log files and move them to folder structure like year/month/day/files.