How do I write log messages in Kohana 3.2?

krische picture krische · Oct 20, 2011 · Viewed 10k times · Source

Ok I've tried searching all over but can't seem to get just a simple straight forward answer.

I want to write log messages (INFO, ERROR, etc.) to the Kohana log file /application/logs/YYYY/MM/DD.php.

How do I do it?

Answer

Dickie picture Dickie · Oct 21, 2011

Try the log class add() method: http://kohanaframework.org/3.2/guide/api/Log#add

Call it like this:

Log::instance()->add(Log::NOTICE, 'My Logged Message Here');

For the first parameter (level) use one of the 9 constants defined in the log class