<?php class Log() { public function log($message) { if( $message == "" ) { return; } $message = date("Y-m-d H:i:s")." – ".$message."rn"; file_put_contents("./messages.log", $message, FILE_APPEND); } } // do some stuff $oLog = new Log(); $oLog->Log("all done!"); ?>