Closed 3Hren closed 7 years ago
This commit allows to perform lazy argument formatting using lambdas, that accepts std::ostream object. It’s not super-fast, due to usage of std::ostream inside libfmt, but it works!
std::ostream
libfmt
For example:
logger.log(0, "[::] - esafronov [10/Oct/2000:13:55:36 -0700] 'GET {} HTTP/1.0' 200 2326", [&](std::ostream& stream) -> std::ostream& { return stream << boost::join(paths, "/"); } );
Performance difference:
log.lit[args: 1] 256 256 2668313 3.72516M items/s log.lit[args: 1 (lazy)] 418 417 1712731 2.28555M items/s
@antmat @karitra PTAL, dragons may be there...
Since noone reacted (except @shaitan) I'll merge this today when CI lands.
ABI report: compatible.
This commit allows to perform lazy argument formatting using lambdas, that accepts
std::ostream
object. It’s not super-fast, due to usage ofstd::ostream
insidelibfmt
, but it works!For example:
Performance difference:
@antmat @karitra PTAL, dragons may be there...