00001 <?php
00002 include_once(GALAXIA_LIBRARY.'/src/common/Observer.php');
00005
00009 class Logger extends Observer {
00010 var $_filename;
00011
00012 function Logger($filename) {
00013 $this->_filename = $filename;
00014 $fp = fopen($this->_filename,"a");
00015 if(!$fp) {
00016 trigger_error("Logger cannot append to log file: ".$this->filename,E_USER_WARNING);
00017 }
00018 if($fp) {
00019 fclose($fp);
00020 }
00021
00022 }
00023
00024 function notify($event,$msg) {
00025
00026 $fp = fopen($this->_filename,"a");
00027 $date = date("[d/m/Y h:i:s]");
00028 $msg=trim($msg);
00029 fputs($fp,$date." ".$msg."\n");
00030 fclose($fp);
00031 }
00032 }
00033 ?>