本文整理匯總了PHP中MWExceptionHandler::getPublicLogMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP MWExceptionHandler::getPublicLogMessage方法的具體用法?PHP MWExceptionHandler::getPublicLogMessage怎麽用?PHP MWExceptionHandler::getPublicLogMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MWExceptionHandler
的用法示例。
在下文中一共展示了MWExceptionHandler::getPublicLogMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: output
/**
* @param Exception|Throwable $e Original exception
* @param integer $mode MWExceptionExposer::AS_* constant
* @param Exception|Throwable|null $eNew New exception from attempting to show the first
*/
public static function output($e, $mode, $eNew = null)
{
global $wgMimeType;
if (defined('MW_API')) {
// Unhandled API exception, we can't be sure that format printer is alive
self::header('MediaWiki-API-Error: internal_api_error_' . get_class($e));
wfHttpError(500, 'Internal Server Error', self::getText($e));
} elseif (self::isCommandLine()) {
self::printError(self::getText($e));
} elseif ($mode === self::AS_PRETTY) {
if ($e instanceof DBConnectionError) {
self::reportOutageHTML($e);
} else {
self::statusHeader(500);
self::header("Content-Type: {$wgMimeType}; charset=utf-8");
self::reportHTML($e);
}
} else {
if ($eNew) {
$message = "MediaWiki internal error.\n\n";
if (self::showBackTrace($e)) {
$message .= 'Original exception: ' . MWExceptionHandler::getLogMessage($e) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($e) . "\n\nException caught inside exception handler: " . MWExceptionHandler::getLogMessage($eNew) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($eNew);
} 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";
} else {
if (self::showBackTrace($e)) {
$message = MWExceptionHandler::getLogMessage($e) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($e) . "\n";
} else {
$message = MWExceptionHandler::getPublicLogMessage($e);
}
}
if (self::isCommandLine()) {
self::printError($message);
} else {
echo nl2br(htmlspecialchars($message)) . "\n";
}
}
}
示例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);
}