本文整理汇总了PHP中LoggerLevel::getLevelDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLevel::getLevelDebug方法的具体用法?PHP LoggerLevel::getLevelDebug怎么用?PHP LoggerLevel::getLevelDebug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerLevel
的用法示例。
在下文中一共展示了LoggerLevel::getLevelDebug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConstructWithTimestamp
public function testConstructWithTimestamp()
{
$l = LoggerLevel::getLevelDebug();
$timestamp = microtime(true);
$e = new LoggerLoggingEvent('fqcn', 'TestLogger', $l, 'test', $timestamp);
self::assertEquals($e->getTimeStamp(), $timestamp);
}
示例2: getLoggerLevel
public static function getLoggerLevel($level)
{
switch (strtolower($level)) {
case 'trace':
$level = LoggerLevel::getLevelTrace();
break;
case 'debug':
$level = LoggerLevel::getLevelDebug();
break;
case 'warn':
$level = LoggerLevel::getLevelWarn();
break;
case 'error':
$level = LoggerLevel::getLevelError();
break;
case 'fatal':
$level = LoggerLevel::getLevelFatal();
break;
case 'info':
default:
$level = LoggerLevel::getLevelInfo();
break;
}
return $level;
}
示例3: testDebugLayout
public function testDebugLayout()
{
$event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
$v = $this->formatEvent($event, $this->pattern);
$dt = $this->getEventDateTime($event);
$e = "{$dt} DEBUG TEST (LoggerLayoutXml): testmessage in NA at NA" . PHP_EOL;
self::assertEquals($e, $v);
}
示例4: testPhp
public function testPhp()
{
$appender = new LoggerAppenderPhp("TEST");
$layout = new LoggerLayoutSimple();
$appender->setLayout($layout);
$appender->activateOptions();
$event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
$appender->append($event);
$event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$appender->append($event);
$event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
$appender->append($event);
}
示例5: testDecide
public function testDecide()
{
$filter = new LoggerFilterDenyAll();
$eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
$eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
$eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$result = $filter->decide($eventError);
self::assertEquals($result, LoggerFilter::DENY);
$result = $filter->decide($eventDebug);
self::assertEquals($result, LoggerFilter::DENY);
$result = $filter->decide($eventWarn);
self::assertEquals($result, LoggerFilter::DENY);
}
示例6: testDecide
public function testDecide()
{
$filter = new MyFilter();
// activateOptions is empty, but should at least throw no exeception
$filter->activateOptions();
$eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
$eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
$eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$result = $filter->decide($eventError);
self::assertEquals($result, LoggerFilter::NEUTRAL);
$result = $filter->decide($eventDebug);
self::assertEquals($result, LoggerFilter::NEUTRAL);
$result = $filter->decide($eventWarn);
self::assertEquals($result, LoggerFilter::NEUTRAL);
}
示例7: setupLogging
private function setupLogging()
{
$this->logger = Logger::getLogger('Panopta API');
$this->logger->setLevel($this->logLevel == LOG_INFO ? LoggerLevel::getLevelInfo() : LoggerLevel::getLevelDebug());
$logAppender = new LoggerAppenderDailyFile();
$logAppender->setFile(rtrim(rtrim($this->logPath, "/"), "\\") . DIRECTORY_SEPARATOR . "panopta_api.log");
$logAppender->setAppend(true);
$logAppender->setDatePattern("yyyy-MM-dd'.log'");
$logAppender->setThreshold($this->logLevel);
$pattern = new LoggerLayoutPattern();
$pattern->setConversionPattern("%date - %logger - %level - %message%newline");
$logAppender->setLayout($pattern);
$logAppender->activateOptions();
$this->logger->addAppender($logAppender);
}
示例8: append
function append($event)
{
$level = $event->getLevel();
$message = $event->getRenderedMessage();
if ($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) {
syslog(LOG_ALERT, $message);
} elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
syslog(LOG_ERR, $message);
} elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
syslog(LOG_WARNING, $message);
} elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) {
syslog(LOG_INFO, $message);
} elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) {
syslog(LOG_DEBUG, $message);
}
}
示例9: testDecideAcceptFalse
public function testDecideAcceptFalse()
{
$filter = new LoggerFilterLevelRange();
$filter->setAcceptOnMatch("false");
$filter->setLevelMin(LoggerLevel::getLevelWarn());
$filter->setLevelMax(LoggerLevel::getLevelError());
$eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
$eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
$eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$result = $filter->decide($eventError);
self::assertEquals($result, LoggerFilter::NEUTRAL);
$result = $filter->decide($eventDebug);
self::assertEquals($result, LoggerFilter::DENY);
$result = $filter->decide($eventWarn);
self::assertEquals($result, LoggerFilter::NEUTRAL);
}
示例10: testResetConfiguration
public function testResetConfiguration()
{
$root = $this->hierarchy->getRootLogger();
$appender = new LoggerAppenderConsole('A1');
$root->addAppender($appender);
$logger = $this->hierarchy->getLogger('test');
self::assertEquals(1, count($this->hierarchy->getCurrentLoggers()));
$this->hierarchy->resetConfiguration();
self::assertEquals(LoggerLevel::getLevelDebug(), $root->getLevel());
self::assertEquals(LoggerLevel::getLevelAll(), $this->hierarchy->getThreshold());
self::assertEquals(1, count($this->hierarchy->getCurrentLoggers()));
foreach ($this->hierarchy->getCurrentLoggers() as $logger) {
self::assertNull($logger->getLevel());
self::assertTrue($logger->getAdditivity());
self::assertEquals(0, count($logger->getAllAppenders()), 0);
}
}
示例11: testDefaultConfig
/** Check default setup. */
public function testDefaultConfig()
{
Logger::configure();
$actual = Logger::getCurrentLoggers();
$expected = array();
$this->assertSame($expected, $actual);
$appenders = Logger::getRootLogger()->getAllAppenders();
$this->assertInternalType('array', $appenders);
$this->assertEquals(count($appenders), 1);
$names = array_keys($appenders);
$this->assertSame('default', $names[0]);
$appender = array_shift($appenders);
$this->assertInstanceOf('LoggerAppenderEcho', $appender);
$this->assertSame('default', $appender->getName());
$layout = $appender->getLayout();
$this->assertInstanceOf('LoggerLayoutTTCC', $layout);
$root = Logger::getRootLogger();
$appenders = $root->getAllAppenders();
$this->assertInternalType('array', $appenders);
$this->assertEquals(count($appenders), 1);
$actual = $root->getLevel();
$expected = LoggerLevel::getLevelDebug();
$this->assertEquals($expected, $actual);
}
示例12: testDecideDeny
public function testDecideDeny()
{
$filter = new LoggerFilterStringMatch();
$filter->setAcceptOnMatch("false");
$filter->setStringToMatch("testmessage");
$eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
$eventError2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "xyz");
$eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
$eventDebug2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "xyz");
$eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$eventWarn2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "xyz");
$result = $filter->decide($eventError);
self::assertEquals($result, LoggerFilter::DENY);
$result = $filter->decide($eventError2);
self::assertEquals($result, LoggerFilter::NEUTRAL);
$result = $filter->decide($eventDebug);
self::assertEquals($result, LoggerFilter::DENY);
$result = $filter->decide($eventDebug2);
self::assertEquals($result, LoggerFilter::NEUTRAL);
$result = $filter->decide($eventWarn);
self::assertEquals($result, LoggerFilter::DENY);
$result = $filter->decide($eventWarn2);
self::assertEquals($result, LoggerFilter::NEUTRAL);
}
示例13: testLevelDebug
public function testLevelDebug()
{
$this->doTestLevel(LoggerLevel::getLevelDebug(), LoggerLevel::DEBUG, 'DEBUG', 7);
$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::DEBUG), LoggerLevel::DEBUG, 'DEBUG', 7);
$this->doTestLevel(LoggerLevel::toLevel('DEBUG'), LoggerLevel::DEBUG, 'DEBUG', 7);
}
示例14: explode
/**
* This method must work for the root category as well.
*
* @param array $props array of properties
* @param Logger &$logger
* @param string $optionKey
* @param string $loggerName
* @param string $value
* @return Logger
*/
function &parseCategory($props, &$logger, $optionKey, $loggerName, $value)
{
LoggerLog::debug("LoggerPropertyConfigurator::parseCategory() " . "Parsing for [{$loggerName}] with value=[{$value}].");
// We must skip over ',' but not white space
$st = explode(',', $value);
// If value is not in the form ", appender.." or "", then we should set
// the level of the loggeregory.
if (!(@$value[0] == ',' || empty($value))) {
// just to be on the safe side...
if (sizeof($st) == 0) {
return;
}
$levelStr = current($st);
LoggerLog::debug("LoggerPropertyConfigurator::parseCategory() " . "Level token is [{$levelStr}].");
// If the level value is inherited, set category level value to
// null. We also check that the user has not specified inherited for the
// root category.
if ('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
if ($loggerName == LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_INTERNAL_ROOT_NAME) {
LoggerLog::warn("LoggerPropertyConfigurator::parseCategory() " . "The root logger cannot be set to null.");
} else {
$logger->setLevel(null);
}
} else {
$logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
}
}
// Begin by removing all existing appenders.
$logger->removeAllAppenders();
while ($appenderName = next($st)) {
$appenderName = trim($appenderName);
if (empty($appenderName)) {
continue;
}
LoggerLog::debug("LoggerPropertyConfigurator::parseCategory() " . "Parsing appender named [{$appenderName}].");
$appender =& $this->parseAppender($props, $appenderName);
if ($appender !== null) {
$logger->addAppender($appender);
}
}
}
示例15: getAllLevels
/** Returns an array of all existing levels, sorted ascending by severity. */
public static function getAllLevels()
{
return array(LoggerLevel::getLevelTrace(), LoggerLevel::getLevelDebug(), LoggerLevel::getLevelInfo(), LoggerLevel::getLevelWarn(), LoggerLevel::getLevelError(), LoggerLevel::getLevelFatal());
}