Add printf format checking to printf-style log constructors.

This improves safety by diagnosing format string mismatches under both Clang and GCC.
Merge pull request #3311 from nneonneo/printf_patch

Add printf format checking to printf-style log constructors.