本文整理汇总了PHP中Exception::isLoggable方法的典型用法代码示例。如果您正苦于以下问题:PHP Exception::isLoggable方法的具体用法?PHP Exception::isLoggable怎么用?PHP Exception::isLoggable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::isLoggable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logException
/**
* Log an exception to the exception log (if enabled).
*
* This method must not assume the exception is an MWException,
* it is also used to handle PHP exceptions or exceptions from other libraries.
*
* @since 1.22
* @param Exception|Throwable $e
*/
public static function logException($e)
{
if (!$e instanceof MWException || $e->isLoggable()) {
$logger = LoggerFactory::getInstance('exception');
$logger->error(self::getLogMessage($e), self::getLogContext($e));
$json = self::jsonSerializeException($e, false, FormatJson::ALL_OK);
if ($json !== false) {
$logger = LoggerFactory::getInstance('exception-json');
$logger->error($json, ['private' => true]);
}
Hooks::run('LogException', [$e, false]);
}
}
示例2: logException
/**
* Log an exception to the exception log (if enabled).
*
* This method must not assume the exception is an MWException,
* it is also used to handle PHP exceptions or exceptions from other libraries.
*
* @since 1.22
* @param Exception $e
*/
public static function logException(Exception $e)
{
global $wgLogExceptionBacktrace;
if (!$e instanceof MWException || $e->isLoggable()) {
$log = self::getLogMessage($e);
if ($wgLogExceptionBacktrace) {
wfDebugLog('exception', $log . "\n" . $e->getTraceAsString());
} else {
wfDebugLog('exception', $log);
}
$json = self::jsonSerializeException($e, false, FormatJson::ALL_OK);
if ($json !== false) {
wfDebugLog('exception-json', $json, 'private');
}
Hooks::run('LogException', array($e, false));
}
}
示例3: logException
/**
* Log an exception to the exception log (if enabled).
*
* This method must not assume the exception is an MWException,
* it is also used to handle PHP errors or errors from other libraries.
*
* @since 1.22
* @param Exception $e
*/
public static function logException( Exception $e ) {
global $wgLogExceptionBacktrace;
if ( !( $e instanceof MWException ) || $e->isLoggable() ) {
$log = self::getLogMessage( $e );
if ( $wgLogExceptionBacktrace ) {
wfDebugLog( 'exception', $log . "\n" . $e->getTraceAsString() . "\n" );
} else {
wfDebugLog( 'exception', $log );
}
}
}