radiosilence/Ham — pull request #6 by robmiller (2012-05-03 21:30:03+00:00)
Title: Logging functionality

Thanks for Ham, it's great! Out of boredom and as a way of trying to give back, I had a crack at creating some logging functionality.

I created an abstract HamLogger class with the methods each logger needs to implement: error, log, and info. This architecture is modeled on the existing cache functionality, and has a factory in the Ham class (for if there are other logging methods in the future).

Then, there's a FileLogger logger that logs to a text file; each log entry goes on a new line, with each field tab-separated.

Finally, I added an argument to the constructor, after `$cache`, to specify the location of the log file.

To log, you simply call:

$app->logger->error('Something went wrong');

from anywhere in your app.