Changeset 416
- Timestamp:
- 03/23/07 16:27:50 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/util/log/stubLogDataFactory.php
r359 r416 7 7 * @subpackage util_log 8 8 */ 9 stubClassLoader::load('net.stubbles.ipo.session.stubSession', 10 'net.stubbles.util.log.stubLogData', 11 'net.stubbles.util.log.stubLogger', 12 'net.stubbles.util.stubRegistry' 13 ); 9 14 /** 10 15 * Factory to create log data objects. 11 16 * 17 * @static 12 18 * @package stubbles 13 19 * @subpackage util_log 14 * @static15 20 */ 16 21 class stubLogDataFactory … … 19 24 * creates a stubLogData object 20 25 * 21 * @param stubSession $session the session of the current user22 * @param string $target target where the log data should go to23 * @param int $level optional log level of the log data26 * @param stubSession $session the session of the current user 27 * @param string $target target where the log data should go to 28 * @param int $level optional log level of the log data 24 29 * @return stubLogData 30 * @throws stubException in case the created class is not an instance of stubLogData 25 31 */ 26 32 public static function create(stubSession $session, $target, $level = stubLogger::LEVEL_INFO) 27 33 { 28 $class = stubRegistry::getConfig('net.stubbles.util.log.class', 'net.stubbles.util.log.stubBaseLogData'); 29 stubClassLoader::load($class); 30 $className = stubClassLoader::getNonQualifiedClassName($class); 31 $logData = new $className($session, $target, $level); 34 $fqClassName = stubRegistry::getConfig('net.stubbles.util.log.class', 'net.stubbles.util.log.stubBaseLogData'); 35 $nqClassName = stubClassLoader::getNonQualifiedClassName($fqClassName); 36 if (class_exists($nqClassName, false) == false) { 37 stubClassLoader::load($fqClassName); 38 } 39 40 $logData = new $nqClassName($session, $target, $level); 41 if (($logData instanceof stubLogData) == false) { 42 throw new stubException('Configured net.stubbles.util.log.class is not an instance of stubLogData.'); 43 } 44 32 45 return $logData; 33 46 } trunk/src/test/php/net/stubbles/util/UtilTestSuite.php
r415 r416 33 33 $this->addTestFile($dir . '/log/stubFileLogAppenderTestCase.php'); 34 34 $this->addTestFile($dir . '/log/stubBaseLogDataTestCase.php'); 35 $this->addTestFile($dir . '/log/stubLogDataFactoryTestCase.php'); 35 36 36 37 // now all the validators
