Log Message: |
THRIFT-926. cpp: remove auto-stringification in TLogging.h
The T_DEBUG* and T_ERROR* macros used preprocessor stringification to
stringify the format string argument. This was weird and unintuitive.
With the old behavior:
- Quotes surrounding the format string were included in the message:
T_DEBUG("this is a test") --> expanded to "\"this is a test\""
- Backslashes in the string are escaped so they print literally:
T_DEBUG("foo\nbar") --> expanded to "\"foo\\nbar\""
- Standard fixed-width integer format macros don't work:
T_DEBUG("x: %" PRIi64, x) --> expanded to "\"x: %\" PRIi64"
The last item is particularly problematic, since it prevents 64-bit
values from being logged portably.
With the new code, the following will no longer compile:
T_DEBUG(this is my log message: %d, 5)
I don't think that is a bad thing, though.
|