[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.
Should this not be `MAX_LOGLINE - 2` as we're about to add `\n` and `\0`?