22 #ifndef LOGGER_BOOST_LOG_HPP 23 #define LOGGER_BOOST_LOG_HPP 27 #include <boost/log/common.hpp> 28 #include <boost/log/expressions.hpp> 30 #include <boost/log/utility/setup/file.hpp> 31 #include <boost/log/utility/setup/console.hpp> 32 #include <boost/log/utility/setup/common_attributes.hpp> 34 #include <boost/log/attributes/timer.hpp> 35 #include <boost/log/attributes/named_scope.hpp> 37 #include <boost/log/sources/logger.hpp> 38 #include <boost/log/support/date_time.hpp> 43 namespace logging = boost::log;
45 namespace sinks = boost::log::sinks;
46 namespace attrs = boost::log::attributes;
47 namespace src = boost::log::sources;
48 namespace keywords = boost::log::keywords;
55 inline void initLogger (
int argc,
const char *argv[] ) {
58 for ( uint k = 0; k < argc; ++k ) {
59 if ( !strcmp ( argv[k], lv.c_str() ) ) {
65 logging::add_console_log (
67 keywords::format =
"[%TimeStamp%] %_%" 75 #define LINFO(msg) if (!silent::get()) BOOST_LOG_TRIVIAL(info) << ::ucam::util::filteredHeader(::ucam::util::detailed?__PRETTY_FUNCTION__:__func__)<< ".INF:" << msg ; 76 #define FORCELINFO(msg) BOOST_LOG_TRIVIAL(info) << ::ucam::util::filteredHeader(::ucam::util::detailed?__PRETTY_FUNCTION__:__func__) << ".INF:" << msg ; 79 #define FORCELINFO(msg) 86 #define LDEBUG3(msg) BOOST_LOG_TRIVIAL(debug) << ::ucam::util::filteredHeader(::ucam::util::detailed?__PRETTY_FUNCTION__:__func__)<< ".DBG3:" << msg ; 95 #define LDEBUG2(msg) BOOST_LOG_TRIVIAL(debug) << ::ucam::util::filteredHeader(::ucam::util::detailed?__PRETTY_FUNCTION__:__func__)<< ".DBG2:" << msg ; 104 #define LDEBUG1(msg) BOOST_LOG_TRIVIAL(debug) << ::ucam::util::filteredHeader(::ucam::util::detailed?__PRETTY_FUNCTION__:__func__)<< ".DBG1:" << msg ; 105 #define LDEBUG(msg) BOOST_LOG_TRIVIAL(debug) << ::ucam::util::filteredHeader(::ucam::util::detailed?__PRETTY_FUNCTION__:__func__)<< ".DBG1:" << msg ; 111 #define LDBG_EXECUTE(order) {order;} 113 #define LDBG_EXECUTE(order) 117 #define LERROR(msg) BOOST_LOG_TRIVIAL(error) << ::ucam::util::filteredHeader(::ucam::util::detailed?__PRETTY_FUNCTION__:__func__)<< ".ERR:" << msg ; 123 #define LWARN(msg) BOOST_LOG_TRIVIAL(warning) << ::ucam::util::filteredHeader(::ucam::util::detailed?__PRETTY_FUNCTION__:__func__)<< ".WRN:" << msg ; void initLogger(int argc, const char *argv[])
Inits logger, parses param options checking for –logger.verbose.
static void set(bool silent)
Set silent mode or viceversa.
const std::string kLoggerVerbose