From: Timo Tijhof
Date: Wed, 9 Oct 2013 00:20:41 +0000 (+0200)
Subject: exception: Move logging logic to static method of MWExceptionHandler
X-Git-Tag: 1.31.0-rc.0~18521
X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=f0386d31835b8f65fb7fc1f275d1761cae339e97;p=lhc%2Fweb%2Fwiklou.git
exception: Move logging logic to static method of MWExceptionHandler
Follows-up c28251a9fd, which unconditionally called logException
on objects that aren't always instances of MWException.
This makes it possible to, for example, log PHP errors or errors
from Less in ResourceLoader to be logged as well (which naturally
don't have a logException method).
As a result of the handling now being generic, non-MWException
errors will now be loggable, and also have their ID fixed between
HTML output and the debug log entry.
* Not yet removing MWException::getLogMessage (introduced in bcb9f9e1c)
as it has been around since 2006 (released in 1.8.0).
* Not yet removing MWException::getLogId (introduced in 70841c5867)
as it was part of the 1.20.0 release.
* Removed MWException::logException (introduced in c28251a9fd)
as it was only added a few weeks ago within this release cycle.
Change-Id: Iab98e3a7a9b78d8602e69e0571b35cf107a96b72
---
diff --git a/includes/Exception.php b/includes/Exception.php
index b97697dedf..fba857f90d 100644
--- a/includes/Exception.php
+++ b/includes/Exception.php
@@ -30,7 +30,6 @@
* @ingroup Exception
*/
class MWException extends Exception {
- var $logId;
/**
* Should the exception use $wgOut to output the error?
@@ -131,7 +130,7 @@ class MWException extends Exception {
"
\n";
} else {
return "" .
- '[' . $this->getLogId() . '] ' .
+ '[' . MWExceptionHandler::getLogId( $this ) . '] ' .
gmdate( 'Y-m-d H:i:s' ) .
": Fatal exception of type " . get_class( $this ) . "
\n" .
"