本文整理汇总了PHP中LoggerLevel::getLevelWarn方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLevel::getLevelWarn方法的具体用法?PHP LoggerLevel::getLevelWarn怎么用?PHP LoggerLevel::getLevelWarn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerLevel
的用法示例。
在下文中一共展示了LoggerLevel::getLevelWarn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: testWarnLayout
public function testWarnLayout()
{
$event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$layout = new LoggerLayoutXml();
$v = $layout->format($event);
$e = "<log4php:event logger=\"TEST\" level=\"WARN\" thread=\"" . $event->getThreadName() . "\" timestamp=\"" . number_format((double) ($event->getTimeStamp() * 1000), 0, '', '') . "\">" . PHP_EOL . "<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL . "<log4php:locationInfo class=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " . "method=\"getLocationInformation\" />" . PHP_EOL . "</log4php:event>\n" . PHP_EOL;
self::assertEquals($v, $e);
}
示例3: testWarnLayout
public function testWarnLayout()
{
$event = new LoggerLoggingEvent("LoggerLayoutHtmlTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$layout = new LoggerLayoutHtml();
$v = $layout->format($event);
$e = PHP_EOL . "<tr>" . PHP_EOL . "<td>" . round(1000 * $event->getRelativeTime()) . "</td>" . PHP_EOL . "<td title=\"" . $event->getThreadName() . " thread\">" . $event->getThreadName() . "</td>" . PHP_EOL . "<td title=\"Level\"><font color=\"#993300\"><strong>WARN</strong></font></td>" . PHP_EOL . "<td title=\"TEST category\">TEST</td>" . PHP_EOL . "<td title=\"Message\">testmessage</td>" . PHP_EOL . "</tr>" . PHP_EOL;
self::assertEquals($v, $e);
}
示例4: testWarnLayout
public function testWarnLayout()
{
$event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$v = $this->formatEvent($event, $this->pattern);
$dt = $this->getEventDateTime($event);
$e = "{$dt} WARN TEST (LoggerLayoutXml): testmessage in NA at NA" . PHP_EOL;
self::assertEquals($e, $v);
}
示例5: testSimpleDefaultLogging
public function testSimpleDefaultLogging()
{
$layout = new LoggerLayoutSimple();
$event = new LoggerLoggingEvent('LoggerAppenderConsoleTest', new Logger('mycategory'), LoggerLevel::getLevelWarn(), "my message");
$appender = new LoggerAppenderConsole("mylogger");
$appender->setLayout($layout);
$appender->activateOptions();
$appender->append($event);
$appender->close();
}
示例6: testConfigureWithRootCategory
public function testConfigureWithRootCategory()
{
Logger::configure('configurators/test3.properties');
$root = Logger::getRootLogger();
self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
$appender = $root->getAppender("default");
self::assertTrue($appender instanceof LoggerAppenderEcho);
$layout = $appender->getLayout();
self::assertTrue($layout instanceof LoggerLayoutSimple);
}
示例7: testConfigure
public function testConfigure()
{
Logger::configure('configurators/test1.php', 'LoggerConfiguratorPhp');
$root = Logger::getRootLogger();
self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
$appender = $root->getAppender("default");
self::assertTrue($appender instanceof LoggerAppenderEcho);
$layout = $appender->getLayout();
self::assertTrue($layout instanceof LoggerLayoutSimple);
$logger = Logger::getLogger('mylogger');
self::assertEquals(LoggerLevel::getLevelInfo(), $logger->getLevel());
}
示例8: 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);
}
示例9: 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);
}
示例10: append
public function append(LoggerLoggingEvent $event)
{
$level = $event->getLevel();
if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
trigger_error($this->layout->format($event), E_USER_ERROR);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
trigger_error($this->layout->format($event), E_USER_WARNING);
} else {
trigger_error($this->layout->format($event), E_USER_NOTICE);
}
}
}
示例11: testWarnLayout
public function testWarnLayout()
{
$event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
$layout = new LoggerLayoutTTCC();
$v = $layout->format($event);
$pos = strpos($v, "[" . $event->getThreadName() . "] WARN TEST - testmessage");
if ($pos === false) {
self::assertTrue(false);
} else {
if ($pos === true) {
self::assertTrue(true);
}
}
}
示例12: append
public function append($event)
{
if ($this->layout !== null) {
LoggerLog::debug("LoggerAppenderPhp::append()");
$level = $event->getLevel();
if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
trigger_error($this->layout->format($event), E_USER_ERROR);
} elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
trigger_error($this->layout->format($event), E_USER_WARNING);
} else {
trigger_error($this->layout->format($event), E_USER_NOTICE);
}
}
}
示例13: testSimpleLogging
public function testSimpleLogging()
{
$layout = new LoggerLayoutSimple();
$event = new LoggerLoggingEvent('LoggerAppenderFileTest', new Logger('mycategory'), LoggerLevel::getLevelWarn(), "my message");
$appender = new LoggerAppenderFile("mylogger");
$appender->setFileName('../../../target/temp/phpunit/TEST.txt');
$appender->setLayout($layout);
$appender->activateOptions();
$appender->append($event);
$appender->close();
$v = file_get_contents('../../../target/temp/phpunit/TEST.txt');
$e = "WARN - my message" . PHP_EOL;
self::assertEquals($e, $v);
}
示例14: 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);
}
示例15: 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);
}