[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/logger/appender/appender.class.php" ); 4 5 /** 6 * \ingroup logger 7 * 8 * FileAppender allows a logger to write a message to file. 9 */ 10 class FileAppender extends Appender 11 { 12 /** 13 * An absolute file-system path to the log file. 14 */ 15 var $file; 16 17 /** 18 * A pointer to the log file. 19 * 20 * @access private 21 * @type resource 22 */ 23 var $fp; 24 25 /** 26 * Create a new qFileAppender instance. 27 * 28 * 29 * @param Layout A Layout instance. 30 * @param properties An associative array with properties that might be needed by this 31 * appender 32 * @access public 33 * @since 1.0 34 * @see qAppender 35 */ 36 function FileAppender ($layout, $properties) 37 { 38 parent::Appender($layout, $properties); 39 40 $this->file = $properties["file"]; 41 } 42 43 /** 44 * Open the file pointer. 45 * 46 * <br/><br/> 47 * 48 * <note> 49 * This should never be called manually. 50 * </note> 51 */ 52 function openFP() 53 { 54 $this->fp = fopen( $this->file, "a+" ); 55 if( !$this->fp ) { 56 throw( new Exception( "Cannot open log file: ".$this->file )); 57 die(); 58 } 59 60 return true; 61 } 62 63 /** 64 * Write a message to the log file. 65 * 66 * <br/><br/> 67 * 68 * <note> 69 * This should never be called manually. 70 * </note> 71 * 72 * @param string The message to write. 73 */ 74 function write ($message) 75 { 76 if( !is_resource($this->fp) ) 77 $this->openFP(); 78 79 fwrite( $this->fp, $message ); 80 } 81 } 82 83 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |