XMLDB/log.php

24 lines
489 B
PHP

<?
class Log {
protected $logfile;
function __construct($filename) {
$file = $filename;
$this->logfile = fopen($file, 'a+');
$this->message('Starting log');
}
function message($message) {
$message = '['. date("Y-m-d / H:i:s") . ']'.' - '.$message;
$message .= "\n";
return fwrite( $this->logfile, $message );
}
function __destruct(){
$this->message('Finishing log');
return fclose( $this->logfile );
}
}