| [ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 define( "LOGGER_DEFAULT_CONFIG_FILE_PATH", PLOG_CLASS_PATH."config/logging.properties.php" ); 4 5 lt_include( PLOG_CLASS_PATH."class/file/file.class.php" ); 6 7 /** 8 * loads the config file of the logger. By default it uses config/logging.properties.php 9 * as the config file. See the documentation for the LoggerManager for more details on how 10 * the configuration file should be laid out. 11 * 12 * \ingroup logger 13 */ 14 class LoggerConfigLoader 15 { 16 17 /** 18 * array used to store the keys 19 */ 20 var $_keys; 21 22 function LoggerConfigLoader( $defaultFilePath = LOGGER_DEFAULT_CONFIG_FILE_PATH ) 23 { 24 // load the config file if it is readable 25 if( File::isReadable( $defaultFilePath )) { 26 include( $defaultFilePath ); 27 $this->_keys = $config; 28 } 29 else { 30 throw( new Exception( "There was an error loading logger config file: $defaultFilePath" )); 31 die(); 32 } 33 } 34 35 /** 36 * @param key 37 * @return Returns the value assigned to the given key 38 */ 39 function getValue( $key ) 40 { 41 return( $this->_keys[$key] ); 42 } 43 44 /** 45 * returns a list of all the configured loggers 46 * 47 * @return An arrary with all the configured loggers or an empty array if no 48 * loggers are configured 49 */ 50 function getConfiguredLoggers() 51 { 52 if( is_array( $this->_keys )) 53 return( array_keys( $this->_keys )); 54 else 55 return( Array()); 56 } 57 58 /** 59 * returns all the properties given a logger 60 * 61 * @param logger The logger name 62 * @return An associative array 63 */ 64 function getLoggerProperties( $logger ) 65 { 66 return( $this->getValue( $logger )); 67 } 68 69 /** 70 * returns the default layout for a given logger 71 * 72 * @param logger The logger name 73 * @return The layout/pattern for messages logged via this logger 74 */ 75 function getLoggerLayout( $logger ) 76 { 77 return( $this->getLoggerProperty( $logger, "layout" )); 78 } 79 80 /** 81 * returns the filename where the given logger is going to write its messages 82 * 83 *Â @param logger The logger name 84 * @return The filename. But this parameter is only meaningful for loggers writing to a file! 85 */ 86 function getLoggerFilename( $logger ) 87 { 88 return( $this->getLoggerProperty( $logger, "file" )); 89 } 90 91 /** 92 * returns the appender used by the given logger 93 * 94 * @param logger the logger name 95 * @return the appender configured for this logger 96 */ 97 function getLoggerAppender( $logger ) 98 { 99 return( $this->getLoggerProperty( $logger, "appender" )); 100 } 101 102 /** 103 * returns all properties of a given logger 104 * 105 * @param logger The logger name 106 * @param property The property name 107 * @private 108 * @return the value of the property for the given logger 109 */ 110 function getLoggerProperty( $logger, $property ) 111 { 112 $loggerProperties = $this->getLoggerProperties( $logger ); 113 114 return( $loggerProperties[$property] ); 115 } 116 } 117 ?>
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 |
|