本文整理汇总了PHP中MWExceptionHandler::getLogMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP MWExceptionHandler::getLogMessage方法的具体用法?PHP MWExceptionHandler::getLogMessage怎么用?PHP MWExceptionHandler::getLogMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWExceptionHandler
的用法示例。
在下文中一共展示了MWExceptionHandler::getLogMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rollbackMasterChangesAndLog
/**
* If there are any open database transactions, roll them back and log
* the stack trace of the exception that should have been caught so the
* transaction could be aborted properly.
*
* @since 1.23
* @param Exception $e
*/
public static function rollbackMasterChangesAndLog(Exception $e)
{
$factory = wfGetLBFactory();
if ($factory->hasMasterChanges()) {
wfDebugLog('Bug56269', 'Exception thrown with an uncommited database transaction: ' . MWExceptionHandler::getLogMessage($e) . "\n" . $e->getTraceAsString());
$factory->rollbackMasterChanges();
}
}
示例2: formatExceptionNoComment
/**
* Handle exception display.
*
* @since 1.25
* @param Exception $e Exception to be shown to the user
* @return string Sanitized text that can be returned to the user
*/
protected static function formatExceptionNoComment($e)
{
global $wgShowExceptionDetails;
if (!$wgShowExceptionDetails) {
return MWExceptionHandler::getPublicLogMessage($e);
}
return MWExceptionHandler::getLogMessage($e);
}
示例3: report
/**
* Report an exception to the user
*/
protected static function report(Exception $e)
{
global $wgShowExceptionDetails;
$cmdLine = MWException::isCommandLine();
if ($e instanceof MWException) {
try {
// Try and show the exception prettily, with the normal skin infrastructure
$e->report();
} catch (Exception $e2) {
// Exception occurred from within exception handler
// Show a simpler error message for the original exception,
// don't try to invoke report()
$message = "MediaWiki internal error.\n\n";
if ($wgShowExceptionDetails) {
$message .= 'Original exception: ' . self::getLogMessage($e) . "\nBacktrace:\n" . self::getRedactedTraceAsString($e) . "\n\nException caught inside exception handler: " . self::getLogMessage($e2) . "\nBacktrace:\n" . self::getRedactedTraceAsString($e2);
} else {
$message .= "Exception caught inside exception handler.\n\n" . "Set \$wgShowExceptionDetails = true; at the bottom of LocalSettings.php " . "to show detailed debugging information.";
}
$message .= "\n";
if ($cmdLine) {
self::printError($message);
} else {
echo nl2br(htmlspecialchars($message)) . "\n";
}
}
} else {
$message = "Unexpected non-MediaWiki exception encountered, of type \"" . get_class($e) . "\"";
if ($wgShowExceptionDetails) {
$message .= "\n" . MWExceptionHandler::getLogMessage($e) . "\nBacktrace:\n" . self::getRedactedTraceAsString($e) . "\n";
}
if ($cmdLine) {
self::printError($message);
} else {
echo nl2br(htmlspecialchars($message)) . "\n";
}
}
}
示例4: getText
/**
* Get the text to display when reporting the error on the command line.
* If $wgShowExceptionDetails is true, return a text message with a
* backtrace to the error.
*
* @return string
*/
public function getText()
{
global $wgShowExceptionDetails;
if ($wgShowExceptionDetails) {
return MWExceptionHandler::getLogMessage($this) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($this) . "\n";
} else {
return "Set \$wgShowExceptionDetails = true; " . "in LocalSettings.php to show detailed debugging information.\n";
}
}
示例5: getLogMessage
/**
* Return the requested URL and point to file and line number from which the
* exception occurred
*
* @since 1.8
* @deprecated since 1.22 Use MWExceptionHandler::getLogMessage instead.
* @return string
*/
public function getLogMessage()
{
wfDeprecated(__METHOD__, '1.22');
return MWExceptionHandler::getLogMessage($this);
}
示例6: getText
/**
* @param Exception|Throwable $e
* @return string
*/
private static function getText($e)
{
if (self::showBackTrace($e)) {
return MWExceptionHandler::getLogMessage($e) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($e) . "\n";
} else {
return "Set \$wgShowExceptionDetails = true; " . "in LocalSettings.php to show detailed debugging information.\n";
}
}