This patch adds an output operator overload for std::exception_ptr, to
make it easy to log a caught exception. It always shows the exception's
exact type, and for some types of exceptions (subtypes of std::system_error
and std::exception) it prints more information.
For example, the code
try {
throw std::runtime_error("Hello world");
} catch (...) {
sstlog.warn("Exception: {}", std::current_exception());
}
produces the output:
Exception when deleting sstable file: std::runtime_error (Hello world)
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Supports variadic logging with placeholders, e.g.
logger.error("what happened? x = {}, y = {}", x, y);
Instantiate loggers as static thread_local, e.g.
class foo {
static thread_local logging::logger logger;
};
thread_local logging::logger foo::logger{logging::logger_for<foo>};