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