本文整理汇总了PHP中LoggerLevel::getLevelFatal方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLevel::getLevelFatal方法的具体用法?PHP LoggerLevel::getLevelFatal怎么用?PHP LoggerLevel::getLevelFatal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerLevel
的用法示例。
在下文中一共展示了LoggerLevel::getLevelFatal方法的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: 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);
}
}
示例3: testLevelFatal
public function testLevelFatal()
{
$this->doTestLevel(LoggerLevel::getLevelFatal(), LoggerLevel::FATAL, 'FATAL', 0);
$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::FATAL), LoggerLevel::FATAL, 'FATAL', 0);
$this->doTestLevel(LoggerLevel::toLevel('FATAL'), LoggerLevel::FATAL, 'FATAL', 0);
}
示例4: 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());
}
示例5: doUnexpectedFailure
/**
* Override this method to control what should happen when an exception
* escapes the {@link #processCall(String)} method. The default implementation
* will log the failure and send a generic failure response to the client.<p/>
*
* An "expected failure" is an exception thrown by a service method that is
* declared in the signature of the service method. These exceptions are
* serialized back to the client, and are not passed to this method. This
* method is called only for exceptions or errors that are not part of the
* service method's signature, or that result from SecurityExceptions,
* SerializationExceptions, or other failures within the RPC framework.<p/>
*
* Note that if the desired behavior is to both send the GENERIC_FAILURE_MSG
* response AND to rethrow the exception, then this method should first send
* the GENERIC_FAILURE_MSG response itself (using getThreadLocalResponse), and
* then rethrow the exception. Rethrowing the exception will cause it to
* escape into the servlet container.
*
* @param e the exception which was thrown
*/
protected function doUnexpectedFailure(Exception $e)
{
$this->logger->log(LoggerLevel::getLevelFatal(), $e->getTraceAsString());
//gwtphp.done
$this->logger->log(LoggerLevel::getLevelFatal(), "Exception while dispatching incoming RPC call", $this);
$this->logger->log(LoggerLevel::getLevelFatal(), $e->getMessage(), $this);
// Send GENERIC_FAILURE_MSG with 500 status.
//
$this->respondWithFailure();
}
示例6: isFatalEnabled
/**
* Check whether this Logger is enabled for the FATAL Level.
* @return boolean
*/
public function isFatalEnabled()
{
return $this->isEnabledFor(LoggerLevel::getLevelFatal());
}
示例7: fatal
/**
* Log a message object with the FATAL level including the caller.
*
* @param mixed $message message
* @param mixed $caller caller object or caller string id
*/
public function fatal($message, $caller = null)
{
$fatalLevel = LoggerLevel::getLevelFatal();
if ($this->repository->isDisabled($fatalLevel)) {
return;
}
if ($fatalLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
$this->forcedLog($this->fqcn, $caller, $fatalLevel, $message);
}
}
示例8: fatal
/**
* Log a message object with the FATAL level.
*
* @param mixed $message message
* @param Exception $throwable Optional throwable information to include
* in the logging event.
*/
public function fatal($message, $throwable = null)
{
$this->log(LoggerLevel::getLevelFatal(), $message, $throwable);
}
示例9: fatal
/**
* Log a message object with the FATAL level including the caller.
*
* @param mixed $message message
* @param mixed $caller caller object or caller string id
*/
public function fatal($message, $caller = null)
{
$this->logLevel($message, LoggerLevel::getLevelFatal(), $caller);
}
示例10: switch
/**
* Convert the string passed as argument to a level. If the
* conversion fails, then this method returns a DEBUG Level.
*
* @param mixed $arg
* @param LoggerLevel $default
* @static
*/
function &toLevel($arg, $defaultLevel = null)
{
if ($defaultLevel === null) {
return LoggerLevel::toLevel($arg, LoggerLevel::getLevelDebug());
} else {
if (is_int($arg)) {
switch ($arg) {
case LOG4PHP_LEVEL_ALL_INT:
return LoggerLevel::getLevelAll();
case LOG4PHP_LEVEL_DEBUG_INT:
return LoggerLevel::getLevelDebug();
case LOG4PHP_LEVEL_INFO_INT:
return LoggerLevel::getLevelInfo();
case LOG4PHP_LEVEL_WARN_INT:
return LoggerLevel::getLevelWarn();
case LOG4PHP_LEVEL_ERROR_INT:
return LoggerLevel::getLevelError();
case LOG4PHP_LEVEL_FATAL_INT:
return LoggerLevel::getLevelFatal();
case LOG4PHP_LEVEL_OFF_INT:
return LoggerLevel::getLevelOff();
default:
return $defaultLevel;
}
} else {
switch (strtoupper($arg)) {
case 'ALL':
return LoggerLevel::getLevelAll();
case 'DEBUG':
return LoggerLevel::getLevelDebug();
case 'INFO':
return LoggerLevel::getLevelInfo();
case 'WARN':
return LoggerLevel::getLevelWarn();
case 'ERROR':
return LoggerLevel::getLevelError();
case 'FATAL':
return LoggerLevel::getLevelFatal();
case 'OFF':
return LoggerLevel::getLevelOff();
default:
return $defaultLevel;
}
}
}
}
示例11: 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;
}
}
示例12: _convertESAPILeveltoLoggerLevel
/**
* Helper function.
*
* Converts a logging level.
*
* Converts the ESAPI logging level (a number) or level defined in the ESAPI
* properties file (a string) into the levels used by Apache's log4php. Note
* that log4php does not define a TRACE level and so TRACE is simply an
* alias of ALL which log4php does define.
*
* @param int $level The logging level to convert.
*
* @throws Exception if the supplied level doesn't match a level currently
* defined.
*
* @return int The log4php logging Level equivalent.
*/
private static function _convertESAPILeveltoLoggerLevel($level)
{
if (is_string($level)) {
switch (strtoupper($level)) {
case 'ALL':
/* Same as TRACE */
/* Same as TRACE */
case 'TRACE':
return LoggerLevel::getLevelAll();
case 'DEBUG':
return LoggerLevel::getLevelDebug();
case 'INFO':
return LoggerLevel::getLevelInfo();
case 'WARN':
return LoggerLevel::getLevelWarn();
case 'ERROR':
return LoggerLevel::getLevelError();
case 'FATAL':
return LoggerLevel::getLevelFatal();
case 'OFF':
return LoggerLevel::getLevelOff();
default:
throw new Exception("Invalid logging level Value was: {$level}");
}
} else {
switch ($level) {
case Auditor::ALL:
/* Same as TRACE */
/* Same as TRACE */
case Auditor::TRACE:
return LoggerLevel::getLevelAll();
case Auditor::DEBUG:
return LoggerLevel::getLevelDebug();
case Auditor::INFO:
return LoggerLevel::getLevelInfo();
case Auditor::WARNING:
return LoggerLevel::getLevelWarn();
case Auditor::ERROR:
return LoggerLevel::getLevelError();
case Auditor::FATAL:
return LoggerLevel::getLevelFatal();
case Auditor::OFF:
return LoggerLevel::getLevelOff();
default:
throw new Exception("Invalid logging level Value was: {$level}");
}
}
}
示例13: testSetStringThreshold
public function testSetStringThreshold()
{
$appender = new LoggerAppenderEcho("LoggerAppenderTest");
$layout = new LoggerLayoutSimple();
$appender->setLayout($layout);
$warn = LoggerLevel::getLevelWarn();
$appender->setThreshold('WARN');
$a = $appender->getThreshold();
self::assertEquals($warn, $a);
$e = LoggerLevel::getLevelFatal();
$appender->setThreshold('FATAL');
$a = $appender->getThreshold();
self::assertEquals($e, $a);
$e = LoggerLevel::getLevelError();
$appender->setThreshold('ERROR');
$a = $appender->getThreshold();
self::assertEquals($e, $a);
$e = LoggerLevel::getLevelDebug();
$appender->setThreshold('DEBUG');
$a = $appender->getThreshold();
self::assertEquals($e, $a);
$e = LoggerLevel::getLevelInfo();
$appender->setThreshold('INFO');
$a = $appender->getThreshold();
self::assertEquals($e, $a);
}
示例14: append
public function append($event)
{
if ($this->_option == NULL) {
$this->_option = LOG_PID | LOG_CONS;
}
// Attach the process ID to the message, use the facility defined in the .properties-file
openlog($this->_ident, $this->_option, $this->_facility);
$level = $event->getLevel();
$message = $event->getRenderedMessage();
// 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->_overridePriority) {
syslog($this->_priority, $message);
} else {
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);
}
}
closelog();
}
示例15: testPriorityOverride
public function testPriorityOverride()
{
if (!method_exists('ReflectionProperty', 'setAccessible')) {
$this->markTestSkipped("ReflectionProperty::setAccessible() required to perform this test (available in PHP 5.3.2+).");
}
$appender = new LoggerAppenderSyslog();
$appender->setPriority('EMERG');
$appender->setOverridePriority(true);
$appender->activateOptions();
$levels = array(LoggerLevel::getLevelTrace(), LoggerLevel::getLevelDebug(), LoggerLevel::getLevelInfo(), LoggerLevel::getLevelWarn(), LoggerLevel::getLevelError(), LoggerLevel::getLevelFatal());
$expected = LOG_EMERG;
$method = new ReflectionMethod('LoggerAppenderSyslog', 'getSyslogPriority');
$method->setAccessible(true);
foreach ($levels as $level) {
$actual = $method->invoke($appender, $level);
$this->assertSame($expected, $actual);
}
}