Restructure fatal error formatting.
Split printFatalError() in errorformat.h to separate functions that
print the error header, (part of) the actual message, and the footer.
This makes it possible to print the message in calling code
incrementally instead of formatting it into a string buffer.
It is easier to print the message in parts this way, and there is also
less complications in handling possible std::bad_alloc errors from
manipulating a std::string.
Also added line wrapping functionality to the message writing function,
and improved the appearance of the header.
Part of #838 and #985.
Change-Id: Ief7399d8c7c2c0529e0bc8492726bff827e18c4c