* seastar 0bcdd28...864d6dc (4):
> Logging framework
> Add libubsan and libasan to fedora deps docs
> tests: add rpc cancellable tests
> rpc: add cancellable interface
Dropped logging implementation in favor of seastar's due to a link
conflict with operator<<.
Logging is used in many places including those that shouldn't really
throw any exceptions (destructors, noexcept functions).
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
This is a helper function that returns a log level name. It will be used
by the API to report the log levels.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
The logger class constructor registers itself with the logger registry,
in order to enable dynamically setting log levels. However, since
thread_local variables may be (and are) initialized at the time of first
use, when the program starts up no loggers are registered.
Fix by making loggers global, not thread_local. This requires that the
registry use locking to prevent registration happening on different threads
from corrupting the registry.
Note that technically global variables can also be initialized at the
point of first use, and there is no portable way for classes to self-register.
However this is the best we can do.
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>};