Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

Logger.php

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                 // Add a line to the log file.
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 ?>

Generated on Mon Jun 7 16:37:37 2004 for Galaxia by doxygen 1.3.4