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


PHP Logger::setHandlers方法代码示例

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


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

示例1: __construct

 /**
  * Register this plates view provider with a Pimple container
  *
  * @param string $name
  * @param array  $settings
  */
 public function __construct($name = 'slim-app', $settings = [])
 {
     $this->name = $name;
     $this->monolog = new Logger($this->name);
     $this->settings = array_merge($this->settings, $settings);
     if (null !== $this->settings['timezone']) {
         if (is_string($this->settings['timezone'])) {
             $this->settings['timezone'] = new \DateTimeZone($this->settings['timezone']);
         }
         Logger::setTimezone($this->settings['timezone']);
     }
     $this->monolog->setHandlers($this->settings['handlers']);
     $levels = array_keys(Logger::getLevels());
     if (!in_array(strtoupper($this->settings['level']), $levels)) {
         $this->settings['level'] = 'debug';
     }
     if ($path = $this->settings['directory']) {
         if ($path === 'syslog') {
             $this->useSyslog($this->name, $this->settings['level']);
         } elseif (is_dir($path)) {
             $path .= '/' . $this->name;
             $this->useRotatingFiles($path, $this->settings['level']);
         }
     }
 }
开发者ID:creasi,项目名称:slim-monolog,代码行数:31,代码来源:Monolog.php

示例2: setupHandlers

 /**
  * @param $handlers
  * @param $logOnlyThisHandler
  * @return bool
  */
 protected function setupHandlers($handlers, $logOnlyThisHandler)
 {
     if ($logOnlyThisHandler) {
         $this->logger->setHandlers($handlers);
         return true;
     }
     foreach ($handlers as $handler) {
         $this->logger->pushHandler($handler);
     }
 }
开发者ID:rlacerda83,项目名称:laravel-dynamic-logger,代码行数:15,代码来源:DynamicLogger.php

示例3: setUp

 public function setUp()
 {
     $this->logger = new Logger(__CLASS__);
     $this->testHandler = new TestHandler();
     $streamHandler = new StreamHandler('/tmp/test.log', LogLevel::INFO);
     $this->logger->setHandlers([$streamHandler, $this->testHandler]);
     /** @var SoapSettings $settings */
     $this->settings = FactoryMuffin::instance('WebservicesNl\\Protocol\\Soap\\Client\\SoapSettings');
     $this->manager = new Manager();
     $this->manager->createEndpoint('https://ws1.webservices.nl/soap_doclit');
 }
开发者ID:webservices-nl,项目名称:platform-connector,代码行数:11,代码来源:SoapClientTest.php

示例4: testSetHandlers

 /**
  * @covers Monolog\Logger::setHandlers
  */
 public function testSetHandlers()
 {
     $logger = new Logger(__METHOD__);
     $handler1 = new TestHandler();
     $handler2 = new TestHandler();
     $logger->pushHandler($handler1);
     $logger->setHandlers(array($handler2));
     // handler1 has been removed
     $this->assertEquals(array($handler2), $logger->getHandlers());
     $logger->setHandlers(array("AMapKey" => $handler1, "Woop" => $handler2));
     // Keys have been scrubbed
     $this->assertEquals(array($handler1, $handler2), $logger->getHandlers());
 }
开发者ID:saj696,项目名称:pipe,代码行数:16,代码来源:LoggerTest.php

示例5: setHandlers

 /**
  * Set handlers, replacing all existing ones.
  * 
  * If a map is passed, keys will be ignored.
  *
  * @param \Monolog\HandlerInterface[] $handlers
  * @return $this 
  * @static 
  */
 public static function setHandlers($handlers)
 {
     return \Monolog\Logger::setHandlers($handlers);
 }
开发者ID:samcrosoft,项目名称:MicroTranslate,代码行数:13,代码来源:lumen_ide_helper.php

示例6: exit

 }
 $config = Yaml::parse(file_get_contents($arguments["data"] . "/config.yml"));
 if (empty($config)) {
     print "Could not parse config file";
     exit(2);
 }
 //@FIXME move to application, refactor with symfony config mapping
 try {
     Validator\ConfigValidator::validate($config);
 } catch (InvalidConfigurationException $e) {
     throw new Exception\UserException($e->getMessage());
 }
 $action = isset($config['action']) ? $config['action'] : $action;
 $config = $config['parameters'];
 if ($action !== 'run') {
     $logger->setHandlers(array(new NullHandler(Logger::INFO)));
 }
 // move encrypted params to non-ecrypted
 if (isset($config['elastic']['#host'])) {
     $config['elastic']['host'] = $config['elastic']['#host'];
     unset($config['elastic']['#host']);
 }
 if (isset($config['elastic']['ssh']['keys']['#private'])) {
     $config['elastic']['ssh']['keys']['private'] = $config['elastic']['ssh']['keys']['#private'];
     unset($config['elastic']['ssh']['keys']['#private']);
 }
 // data path
 $config['path'] = $arguments["data"] . '/in/tables';
 $app = new Application($config, $logger);
 $result = $app->run($action, $config);
 if ($action !== 'run') {
开发者ID:keboola,项目名称:elastic-writer,代码行数:31,代码来源:run.php


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