當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Logger::getName方法代碼示例

本文整理匯總了PHP中Monolog\Logger::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Logger::getName方法的具體用法?PHP Logger::getName怎麽用?PHP Logger::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Monolog\Logger的用法示例。


在下文中一共展示了Logger::getName方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addDBHandler

 /**
  * @param resource $stream
  * @param integer  $level  The minimum logging level at which this handler will be triggered
  * @param Boolean  $bubble Whether the messages that are handled can bubble up the stack or not
  */
 public function addDBHandler($stream = null, $level = \Monolog\Logger::DEBUG, $bubble = true)
 {
     if (empty($stream)) {
         $stream = new DBHandler($this->logger->getName() . '_log', $level, $bubble);
     }
     $this->logger->pushHandler($stream);
 }
開發者ID:panvagenas,項目名稱:wp-plugin-core,代碼行數:12,代碼來源:Logger.php

示例2: addLogger

 /**
  * Adds new logging channel to the registry
  *
  * @param  Logger      $logger    Instance of the logging channel
  * @param  string|null $name      Name of the logging channel ($logger->getName() by default)
  * @param  boolean     $overwrite Overwrite instance in the registry if the given name already exists?
  * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists
  */
 public static function addLogger(Logger $logger, $name = null, $overwrite = false)
 {
     $name = $name ?: $logger->getName();
     if (isset(self::$loggers[$name]) && !$overwrite) {
         throw new InvalidArgumentException('Logger with the given name already exists');
     }
     self::$loggers[$name] = $logger;
 }
開發者ID:adrianoaguiar,項目名稱:magento-elasticsearch-module,代碼行數:16,代碼來源:Registry.php

示例3: testWithName

 /**
  * @covers Monolog\Logger::withName
  */
 public function testWithName()
 {
     $first = new Logger('first', array($handler = new TestHandler()));
     $second = $first->withName('second');
     $this->assertSame('first', $first->getName());
     $this->assertSame('second', $second->getName());
     $this->assertSame($handler, $second->popHandler());
 }
開發者ID:jorjoh,項目名稱:Varden,代碼行數:11,代碼來源:LoggerTest.php

示例4: configureHandlers

 /**
  * @param Logger $Logger Logger to configure
  * @param array $config handlers configuration
  *
  * @throws HandlerClassMissingException
  * @throws SectionArgsMissingException
  */
 protected function configureHandlers(Logger $Logger, array $config)
 {
     foreach ($config as $handlerConfig) {
         if (!isset($handlerConfig[Config::HANDLER_CLASS])) {
             throw new HandlerClassMissingException('Handler class is missing for [' . $Logger->getName() . '] log');
         }
         if (!isset($handlerConfig[Config::HANDLER_ARGS])) {
             throw new SectionArgsMissingException('Section args is missing for [' . $Logger->getName() . '] log');
         }
         $Reflector = new ReflectionClass($handlerConfig[Config::HANDLER_CLASS]);
         /** @var HandlerInterface $AbstractHandler */
         $AbstractHandler = $Reflector->newInstanceArgs($handlerConfig[Config::HANDLER_ARGS]);
         if (isset($handlerConfig[Config::HANDLER_FORMATTER])) {
             $this->configureFormatter($Logger, $AbstractHandler, $handlerConfig[Config::HANDLER_FORMATTER]);
         }
         $Logger->pushHandler($AbstractHandler);
     }
 }
開發者ID:amberovsky,項目名稱:zf2-monolog,代碼行數:25,代碼來源:MonologFactory.php

示例5: testGetName

 /**
  * @covers Monolog\Logger::getName
  */
 public function testGetName()
 {
     $logger = new Logger('foo');
     $this->assertEquals('foo', $logger->getName());
 }
開發者ID:saj696,項目名稱:pipe,代碼行數:8,代碼來源:LoggerTest.php

示例6: getName

 /**
  * 
  *
  * @return string 
  * @static 
  */
 public static function getName()
 {
     return \Monolog\Logger::getName();
 }
開發者ID:samcrosoft,項目名稱:MicroTranslate,代碼行數:10,代碼來源:lumen_ide_helper.php

示例7: Logger

#!/usr/bin/env php
<?php 
// Bring in the dependencies
require_once __DIR__ . "/vendor/autoload.php";
use Monolog\Logger;
use LeeSherwood\Ejabberd\AuthenticationService;
use LeeSherwood\Ejabberd\CommandExecutors\DummyCommandExecutor;
// Setup Logger
$logger = new Logger('ejabberdAuth');
// Create the log handler(s) (lower the logging level for more verbosity)
$syslogHandler = new Monolog\Handler\SyslogHandler($logger->getName(), LOG_SYSLOG, Logger::DEBUG);
// Attach the handler
$logger->pushHandler($syslogHandler);
// Setup command executor
$executor = new DummyCommandExecutor();
// Boot the service
$application = new AuthenticationService($logger, $executor);
// Execute the run loop
$application->run();
開發者ID:leesherwood,項目名稱:ejabberd-php-auth,代碼行數:19,代碼來源:EjabberdAuthenticationApplication.php

示例8: getName

 /**
  * @return string
  */
 public function getName()
 {
     return parent::getName();
 }
開發者ID:akentner,項目名稱:incoming-ftp,代碼行數:7,代碼來源:LoggerProxy.php

示例9: clear

 /**
  * @param Logger $logger
  */
 public function clear(Logger $logger)
 {
     $this->db->exec(sprintf('DELETE FROM `%s` WHERE `channel` = ?', $this->table), [$logger->getName()]);
 }
開發者ID:starweb,項目名稱:starlit-db,代碼行數:7,代碼來源:DbHandler.php

示例10: getChannelName

 /**
  * Get the current channel name
  *
  * @return string
  */
 public function getChannelName()
 {
     return $this->channel->getName();
 }
開發者ID:ellipsesynergie,項目名稱:backend-skeleton,代碼行數:9,代碼來源:MonologLogger.php


注:本文中的Monolog\Logger::getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。