當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。