[Reviewer: Andy] Handle snprintf and vsnprintf values appropriately in the logger to avoi...

...d stack problems

Tested by running the Sprout UTs, both with MAX_LOGLINE at its normal value and reduced to 80 (which previously provoked a crash). Includes some speculative but untested fixes to backtrace logging - can you review those particularly carefully?

I only found one other snprintf in cpp-common - in utils.cpp, where we're formatting an IP address and I think there's no risk of overflow.
If we trunctate the log, can we add a `<truncated>` footer (or similar) so it's clear this has happened?