X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdebug%2Flogger%2FLegacyLogger.php;h=72c76434185e90079e2fd31c7b5ccb4f420c0e62;hb=8fc57e9555b704edf883e828878f0120d85a7b1c;hp=6288a504cce23c55286bf823805ffa8e3ccd42af;hpb=d6016fa1f985120829cfeb596571dd844da8b4e3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/debug/logger/LegacyLogger.php b/includes/debug/logger/LegacyLogger.php index 6288a504cc..72c7643418 100644 --- a/includes/debug/logger/LegacyLogger.php +++ b/includes/debug/logger/LegacyLogger.php @@ -21,12 +21,14 @@ namespace MediaWiki\Logger; use DateTimeZone; +use Error; use Exception; use WikiMap; use MWDebug; use MWExceptionHandler; use Psr\Log\AbstractLogger; use Psr\Log\LogLevel; +use Throwable; use UDPTransport; /** @@ -269,7 +271,7 @@ class LegacyLogger extends AbstractLogger { $e = $context['exception']; $backtrace = false; - if ( $e instanceof Exception ) { + if ( $e instanceof Throwable || $e instanceof Exception ) { $backtrace = MWExceptionHandler::getRedactedTrace( $e ); } elseif ( is_array( $e ) && isset( $e['trace'] ) ) { @@ -327,7 +329,7 @@ class LegacyLogger extends AbstractLogger { $date = $d->format( 'D M j G:i:s T Y' ); $host = wfHostname(); - $wiki = WikiMap::getWikiIdFromDomain( WikiMap::getCurrentWikiDomain() ); + $wiki = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() ); $text = "{$date}\t{$host}\t{$wiki}\t{$message}\n"; return $text; @@ -343,7 +345,7 @@ class LegacyLogger extends AbstractLogger { */ protected static function formatAsWfDebugLog( $channel, $message, $context ) { $time = wfTimestamp( TS_DB ); - $wiki = WikiMap::getWikiIdFromDomain( WikiMap::getCurrentWikiDomain() ); + $wiki = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() ); $host = wfHostname(); $text = "{$time} {$host} {$wiki}: {$message}\n"; return $text; @@ -375,7 +377,7 @@ class LegacyLogger extends AbstractLogger { * @return string */ protected static function flatten( $item ) { - if ( null === $item ) { + if ( $item === null ) { return '[Null]'; } @@ -405,8 +407,9 @@ class LegacyLogger extends AbstractLogger { return $item->format( 'c' ); } - if ( $item instanceof Exception ) { - return '[Exception ' . get_class( $item ) . '( ' . + if ( $item instanceof Throwable || $item instanceof Exception ) { + $which = $item instanceof Error ? 'Error' : 'Exception'; + return '[' . $which . ' ' . get_class( $item ) . '( ' . $item->getFile() . ':' . $item->getLine() . ') ' . $item->getMessage() . ']'; }