本文整理汇总了PHP中LoggerLevel::getLevelInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLevel::getLevelInfo方法的具体用法?PHP LoggerLevel::getLevelInfo怎么用?PHP LoggerLevel::getLevelInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerLevel
的用法示例。
在下文中一共展示了LoggerLevel::getLevelInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testThreshold
public function testThreshold()
{
Logger::configure('configurators/test1.xml');
$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);
$threshold = $appender->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelWarn();
self::assertEquals($e, $threshold);
$appender = $root->getAppender("blub");
self::assertTrue($appender instanceof LoggerAppenderEcho);
$layout = $appender->getLayout();
self::assertTrue($layout instanceof LoggerLayoutSimple);
$threshold = $appender->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelInfo();
self::assertEquals($e, $threshold);
$filter = $appender->getFilter();
self::assertTrue($filter instanceof LoggerFilterLevelRange);
$filter2 = $filter->getNext();
self::assertTrue($filter2 instanceof LoggerFilterDenyAll);
$threshold = Logger::getHierarchy()->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelWarn();
self::assertEquals($e, $threshold);
$hierarchy = Logger::getHierarchy();
$map = $hierarchy->getRendererMap();
$clazz = $map->getByClassName('Fruit2');
self::assertTrue($clazz instanceof FruitRenderer2);
}
示例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: testInfoLayout
public function testInfoLayout()
{
$event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelInfo(), "testmessage");
$v = $this->formatEvent($event, $this->pattern);
$dt = $this->getEventDateTime($event);
$e = "{$dt} INFO TEST (LoggerLayoutXml): testmessage in NA at NA" . PHP_EOL;
self::assertEquals($e, $v);
}
示例4: testActivateOptions
/**
* The Null appender does nothing - nothing to assert.
* Just here for the sake of completness and a good testing ratio :-)
*/
public function testActivateOptions()
{
$event = new LoggerLoggingEvent("LoggerAppenderNullTest", new Logger("TEST"), LoggerLevel::getLevelInfo(), "testmessage");
$appender = new LoggerAppenderNull("TEST");
$appender->activateOptions();
$appender->append($event);
$appender->close();
}
示例5: 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());
}
示例6: testLayoutWithLocationInfo
public function testLayoutWithLocationInfo()
{
Logger::configure(array('appenders' => array('default' => array('class' => 'LoggerAppenderEcho', 'layout' => array('class' => 'LoggerLayoutSerialized', 'params' => array('locationInfo' => true)))), 'rootLogger' => array('appenders' => array('default'))));
ob_start();
$foo = Logger::getLogger('foo');
$foo->info("Interesting message.");
$actual = ob_get_contents();
ob_end_clean();
$event = unserialize($actual);
self::assertInstanceOf('LoggerLoggingEvent', $event);
self::assertEquals('Interesting message.', $event->getMessage());
self::assertEquals(LoggerLevel::getLevelInfo(), $event->getLevel());
}
示例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: validateAll
public function validateAll($values, $logLevel = null)
{
//No hay parámetros obligatorios
$validated = array();
foreach ($this->comparer as $key => $function) {
if (key_exists($key, $values)) {
$value = $values[$key];
} else {
$value = null;
}
if (call_user_func($function, $value)) {
$validated[$key] = $value;
} else {
global $log;
if ($logLevel == null) {
$logLevel = \LoggerLevel::getLevelInfo();
}
$error = "El valor '{$value}' no es válido para la key '{$key}'";
$log->log($logLevel, $error);
$validated[$key] = new Debug($error, array('clave' => $key, 'valor' => $value, 'comprobacion' => is_array($function) ? array_pop($function) : $function));
}
}
return $validated;
}
示例10: testThreshold
public function testThreshold()
{
Logger::configure('configurators/test4.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);
$threshold = $appender->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelWarn();
self::assertEquals($e, $threshold);
$appender = $root->getAppender("blub");
self::assertTrue($appender instanceof LoggerAppenderEcho);
$layout = $appender->getLayout();
self::assertTrue($layout instanceof LoggerLayoutSimple);
$threshold = $appender->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelInfo();
self::assertEquals($e, $threshold);
$threshold = Logger::getHierarchy()->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelWarn();
self::assertEquals($e, $threshold);
}
示例11: isInfoEnabled
/**
* Check whether this Logger is enabled for the INFO Level.
* @return boolean
*/
public function isInfoEnabled()
{
return $this->isEnabledFor(LoggerLevel::getLevelInfo());
}
示例12: isInfoEnabled
/**
* Check whether this category is enabled for the info Level.
* @return boolean
* @see LoggerLevel
*/
public function isInfoEnabled()
{
$infoLevel = LoggerLevel::getLevelInfo();
if ($this->repository->isDisabled($infoLevel)) {
return false;
}
return $infoLevel->isGreaterOrEqual($this->getEffectiveLevel());
}
示例13: dataLog
/**
* @return array[]
*/
public function dataLog()
{
return array('emergency' => array('emergency', \LoggerLevel::getLevelFatal()), 'alert' => array('alert', \LoggerLevel::getLevelFatal()), 'critical' => array('critical', \LoggerLevel::getLevelFatal()), 'error' => array('error', \LoggerLevel::getLevelError()), 'warning' => array('warning', \LoggerLevel::getLevelWarn()), 'notice' => array('notice', \LoggerLevel::getLevelWarn()), 'info' => array('info', \LoggerLevel::getLevelInfo()), 'debug' => array('debug', \LoggerLevel::getLevelDebug()));
}
示例14: testAppenderThreshold
public function testAppenderThreshold()
{
Logger::configure(array('rootLogger' => array('appenders' => array('default')), 'appenders' => array('default' => array('class' => 'LoggerAppenderEcho', 'threshold' => 'INFO'))));
$actual = Logger::getRootLogger()->getAppender('default')->getThreshold();
$expected = LoggerLevel::getLevelInfo();
self::assertSame($expected, $actual);
}
示例15: append
public function append(LoggerLoggingEvent $event)
{
if ($this->_option == NULL) {
$this->_option = LOG_PID | LOG_CONS;
}
$level = $event->getLevel();
if ($this->layout === null) {
$message = $event->getRenderedMessage();
} else {
$message = $this->layout->format($event);
}
// If the priority of a syslog message can be overridden by a value defined in the properties-file,
// use that value, else use the one that is defined in the code.
if (!$this->dry) {
// Attach the process ID to the message, use the facility defined in the .properties-file
openlog($this->_ident, $this->_option, $this->_facility);
if ($this->_overridePriority) {
syslog($this->_priority, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) {
syslog(LOG_ALERT, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
syslog(LOG_ERR, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
syslog(LOG_WARNING, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) {
syslog(LOG_INFO, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) {
syslog(LOG_DEBUG, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelTrace())) {
syslog(LOG_DEBUG, $message);
// No trace level in syslog
}
}
}
}
}
}
}
closelog();
} else {
echo "DRY MODE OF SYSLOG APPENDER: " . $message;
}
}