Einfache Logger unter PHP
![PHP: Die Programmiersprache PHP PHP](/blog/uploads/php-med-trans-light.gif)
Es gibt für PHP ja so einige Möglichkeiten, Logs zu erzeugen. Apache Log4PHP dürfte die bekannteste sein, aber ich suchte etwas ganz einfaches und habe KLogger gefunden.
Einfaches Beispiel:
$log = new KLogger('/var/log/'); # Specify the log directory
$log->logInfo('Returned a million search results'); //Prints to the log file
$log->logFatal('Oh dear.'); //Prints to the log file
$log->logInfo('Here is an object', $obj); //Prints to the log file with a dump of the object
Ideal für meinen Einsatzzweck und in wenigen Minuten implementiert.