00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class eZPaymentLogger
00039 {
00040 function eZPaymentLogger( $fileName, $mode )
00041 {
00042 $this->file = fopen( $fileName, $mode );
00043 }
00044
00045 function &CreateNew($fileName)
00046 {
00047 $theLogger = new eZPaymentLogger( $fileName, "wt" );
00048 return $theLogger;
00049 }
00050
00051 function &CreateForAdd($fileName)
00052 {
00053 $theLogger = new eZPaymentLogger( $fileName, "a+t" );
00054 return $theLogger;
00055 }
00056
00057 function writeString( $string, $label='' )
00058 {
00059 if( $this->file )
00060 {
00061 if ( is_object( $string ) || is_array( $string ) )
00062 $string = eZDebug::dumpVariable( $string );
00063
00064 if( $label == '' )
00065 fputs( $this->file, $string."\r\n" );
00066 else
00067 fputs( $this->file, $label . ': ' . $string."\r\n" );
00068 }
00069 }
00070
00071 function writeTimedString( $string, $label='' )
00072 {
00073 if( $this->file )
00074 {
00075 $time = $this->getTime();
00076
00077 if ( is_object( $string ) || is_array( $string ) )
00078 $string = eZDebug::dumpVariable( $string );
00079
00080 if( $label == '' )
00081 fputs( $this->file, $time. ' '. $string. "\n" );
00082 else
00083 fputs( $this->file, $time. ' '. $label. ': '. $string. "\n" );
00084 }
00085 }
00086
00087 function getTime()
00088 {
00089 $time = strftime( "%d-%m-%Y %H-%M" );
00090 return $time;
00091 }
00092
00093 var $file;
00094 }
00095 ?>