当前位置: 首页>>代码示例>>PHP>>正文


PHP LoggerOptionConverter::toBooleanEx方法代码示例

本文整理汇总了PHP中LoggerOptionConverter::toBooleanEx方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerOptionConverter::toBooleanEx方法的具体用法?PHP LoggerOptionConverter::toBooleanEx怎么用?PHP LoggerOptionConverter::toBooleanEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LoggerOptionConverter的用法示例。


在下文中一共展示了LoggerOptionConverter::toBooleanEx方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setBoolean

 /**
  * Setter function for boolean type.
  */
 protected function setBoolean($property, $value)
 {
     try {
         $this->{$property} = LoggerOptionConverter::toBooleanEx($value);
     } catch (Exception $ex) {
         $value = var_export($value, true);
         $this->warn("Invalid value given for '{$property}' property: [{$value}]. Expected a boolean value. Property not changed.");
     }
 }
开发者ID:josefd8,项目名称:dashboardWeb,代码行数:12,代码来源:LoggerConfigurable.php

示例2: configureLogger

 /**
  * Configures a logger. 
  * 
  * @param Logger $logger The logger to configure
  * @param array $config Logger configuration options.
  */
 private function configureLogger(Logger $logger, $config)
 {
     $loggerName = $logger->getName();
     // Set logger level
     if (isset($config['level'])) {
         $level = LoggerLevel::toLevel($config['level']);
         if (isset($level)) {
             $logger->setLevel($level);
         } else {
             $this->warn("Invalid level value [{$config['level']}] specified for logger [{$loggerName}]. Ignoring level definition.");
         }
     }
     // Link appenders to logger
     if (isset($config['appenders'])) {
         foreach ($config['appenders'] as $appenderName) {
             if (isset($this->appenders[$appenderName])) {
                 $logger->addAppender($this->appenders[$appenderName]);
             } else {
                 $this->warn("Nonexistnant appender [{$appenderName}] linked to logger [{$loggerName}].");
             }
         }
     }
     // Set logger additivity
     if (isset($config['additivity'])) {
         try {
             $additivity = LoggerOptionConverter::toBooleanEx($config['additivity'], null);
             $logger->setAdditivity($additivity);
         } catch (Exception $ex) {
             $this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [{$loggerName}]. Ignoring additivity setting.");
         }
     }
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:38,代码来源:LoggerConfiguratorDefault.php

示例3: testBooleanValues

 /**
  * Check that various boolean equivalents from ini file convert properly 
  * to boolean. 
  */
 public function testBooleanValues()
 {
     $values = parse_ini_file(PHPUNIT_CONFIG_DIR . '/adapters/ini/values.ini');
     $actual = LoggerOptionConverter::toBooleanEx($values['unquoted_true']);
     self::assertTrue($actual);
     $actual = LoggerOptionConverter::toBooleanEx($values['unquoted_yes']);
     self::assertTrue($actual);
     $actual = LoggerOptionConverter::toBooleanEx($values['unquoted_false']);
     self::assertFalse($actual);
     $actual = LoggerOptionConverter::toBooleanEx($values['unquoted_no']);
     self::assertFalse($actual);
     $actual = LoggerOptionConverter::toBooleanEx($values['quoted_true']);
     self::assertTrue($actual);
     $actual = LoggerOptionConverter::toBooleanEx($values['quoted_false']);
     self::assertFalse($actual);
     $actual = LoggerOptionConverter::toBooleanEx($values['unquoted_one']);
     self::assertTrue($actual);
     $actual = LoggerOptionConverter::toBooleanEx($values['unquoted_zero']);
     self::assertFalse($actual);
 }
开发者ID:scottleedavis,项目名称:hackazon,代码行数:24,代码来源:LoggerConfigurationAdapterINITest.php

示例4: testToBooleanFailure2

 /**
  * Test fail on invalid string.
  * @expectedException LoggerException
  * @expectedExceptionMessage Given value ['foo'] cannot be converted to boolean.
  */
 public function testToBooleanFailure2()
 {
     LoggerOptionConverter::toBooleanEx('foo');
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:9,代码来源:LoggerOptionConverterTest.php


注:本文中的LoggerOptionConverter::toBooleanEx方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。