本文整理汇总了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);
}
示例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;
}
示例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());
}
示例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);
}
}
示例5: testGetName
/**
* @covers Monolog\Logger::getName
*/
public function testGetName()
{
$logger = new Logger('foo');
$this->assertEquals('foo', $logger->getName());
}
示例6: getName
/**
*
*
* @return string
* @static
*/
public static function getName()
{
return \Monolog\Logger::getName();
}
示例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();
示例8: getName
/**
* @return string
*/
public function getName()
{
return parent::getName();
}
示例9: clear
/**
* @param Logger $logger
*/
public function clear(Logger $logger)
{
$this->db->exec(sprintf('DELETE FROM `%s` WHERE `channel` = ?', $this->table), [$logger->getName()]);
}
示例10: getChannelName
/**
* Get the current channel name
*
* @return string
*/
public function getChannelName()
{
return $this->channel->getName();
}