logging: make objectToString() identical to toAppend() when available
Summary: If `toAppend(std::string*, const Object&)` is defined for a particular object type, make `objectToString()` simply return the exact output of `toAppend()`. Previously the code returned `(type_name: toAppendResult)` The new logic is based on the assumption that if `toAppend()` is implemented for an object, it should emit all relevant information about the object that may be needed by a developer. The old behavior of always including type information was potentially helpful in cases where `objectToString()` was called only in exceptional cases. (e.g., after an exception thrown by `folly::format()`). However it made `objectToString()` too verbose in other non-exceptional situations where we want to format objects (e.g., in `XCHECK_EQ()`). There doesn't really seem to be a strong need to keep the type information in the `folly::format()` exception case, so this just drops it rather than adding two separate versions of this function. Reviewed By: chadaustin Differential Revision: D14545303 fbshipit-source-id: 29e2f12d65fd22112486ed11f989b63875980088
Showing
Please register or sign in to comment