1 #ifndef B0__LOGGER__INTERFACE_H__INCLUDED 2 #define B0__LOGGER__INTERFACE_H__INCLUDED 6 #include <boost/format.hpp> 42 virtual void log(
LogLevel level, std::string message)
const = 0;
47 template<
typename... Arguments>
48 void log(
LogLevel level, std::string
const &fmt, Arguments&&... args)
const 52 boost::format format(fmt);
53 log_helper(level, format, std::forward<Arguments>(args)...);
55 catch(boost::io::too_many_args &ex)
58 s +=
" (error during formatting)";
66 virtual void log_helper(
LogLevel level, boost::format &format)
const;
68 template<
class T,
class... Args>
69 void log_helper(
LogLevel level, boost::format &format, T &&t, Args&&... args)
const 71 return log_helper(level, format % std::forward<T>(t), std::forward<Args>(args)...);
81 #endif // B0__LOGGER__INTERFACE_H__INCLUDED The most verbose level.
Definition: interface.h:26
LogLevel
Definition: interface.h:23
The default level, should not cause too much spam on the console.
Definition: interface.h:30
Less verbose than TRACE.
Definition: interface.h:28
Warning level.
Definition: interface.h:32
Error level.
Definition: interface.h:34
Fatal error level, after which the node would usually terminate.
Definition: interface.h:36
void log(LogLevel level, std::string const &fmt, Arguments &&... args) const
Log a message using a format string.
Definition: interface.h:48
virtual void log(LogLevel level, std::string message) const =0
Log a message to the remote logger, with a specified level.
Base class to add logging functionalities to nodes.
Definition: interface.h:17