generalize BitmapHandler::logErrorForExternalProcess

BitmapHandler::logErrorForExternalProcess is a wrapper around
wfDebugLog( 'thumbnail' ). It got copy pasted from some other class at
one point.

This patch move the method up to general class MediaHandler and makes
other child class uses it.  The method will thus be available to
extensions such as TimedMediaHandler.

The reason I am doing that is that trim($err) generates a copy of $err
which causes a memory allocation fatal error whenever $err is larger
than the remaining memory allocatable.  The patch will let us fix the
bug by only altering one part of the code.

bug: 57985
Change-Id: I5657f07d6e2cca05d53f2a5c30ec23622c171343