Registers the error handler.
integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable):
Boolean $displayErrors Display errors (for dev environment) or just log they (production usage):
The registered error handler
public static function register($level = null, $displayErrors = true) {
  $handler = new static();
  $handler
    ->setLevel($level);
  $handler
    ->setDisplayErrors($displayErrors);
  ini_set('display_errors', 0);
  set_error_handler(array(
    $handler,
    'handle',
  ));
  register_shutdown_function(array(
    $handler,
    'handleFatal',
  ));
  $handler->reservedMemory = str_repeat('x', 10240);
  return $handler;
}