mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
add a command line to enable/disable the color format in the fairmq log console output
This commit is contained in:
parent
10d6482716
commit
35c64c67a2
|
@ -49,7 +49,7 @@ void init_log_console(bool color_format)
|
|||
{
|
||||
// add a text sink
|
||||
typedef sinks::synchronous_sink<sinks::text_ostream_backend> text_sink;
|
||||
|
||||
logging::core::get()->remove_all_sinks();
|
||||
|
||||
// CONSOLE - all severity except error
|
||||
boost::shared_ptr<text_sink> sink = boost::make_shared<text_sink>();
|
||||
|
@ -62,7 +62,7 @@ void init_log_console(bool color_format)
|
|||
else
|
||||
sink->set_formatter(&init_log_formatter<tag_file>);
|
||||
|
||||
sink->set_filter(severity != SEVERITY_ERROR);
|
||||
sink->set_filter(severity != SEVERITY_ERROR && severity < SEVERITY_NOLOG);
|
||||
// add sink to the core
|
||||
logging::core::get()->add_sink(sink);
|
||||
|
||||
|
@ -82,6 +82,7 @@ void init_log_console(bool color_format)
|
|||
|
||||
void reinit_logger(bool color_format)
|
||||
{
|
||||
LOG(NOLOG)<<"";
|
||||
logging::core::get()->remove_all_sinks();
|
||||
init_log_console(color_format);
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ inline std::string write_in(const std::string& text_in_bold)
|
|||
typedef fairmq::severity_level custom_severity_level;
|
||||
#define SEVERITY_THRESHOLD custom_severity_level::TRACE
|
||||
#define SEVERITY_ERROR custom_severity_level::ERROR
|
||||
#define SEVERITY_NOLOG custom_severity_level::NOLOG
|
||||
|
||||
// tags used for log console or file formatting
|
||||
struct tag_console;
|
||||
|
|
|
@ -61,6 +61,9 @@ int FairMQProgOptions::ParseAll(const int argc, char** argv, bool allowUnregiste
|
|||
|
||||
// set log level before printing (default is 0 = DEBUG level)
|
||||
std::string verbose=GetValue<std::string>("verbose");
|
||||
bool color_format=GetValue<bool>("log-color-format");
|
||||
if(!color_format)
|
||||
reinit_logger(false);
|
||||
//SET_LOG_LEVEL(DEBUG);
|
||||
if (fSeverityMap.count(verbose))
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ FairProgOptions::FairProgOptions() :
|
|||
" STATE \n"
|
||||
" NOLOG"
|
||||
)
|
||||
("log-color-format", po::value<bool>()->default_value(true), "logger color format : true or false")
|
||||
;
|
||||
|
||||
fSeverityMap["TRACE"] = fairmq::severity_level::TRACE;
|
||||
|
|
|
@ -210,10 +210,17 @@ namespace fairmq
|
|||
if (is_this_type<std::size_t>(varValue))
|
||||
return T::template Value<std::size_t>(varValue,std::string(" [Type=std::size_t]"),defaultedValue,emptyValue);
|
||||
|
||||
// std::vector short
|
||||
// std::vector size_t
|
||||
if (is_this_type<std::vector<std::size_t>>(varValue))
|
||||
return T::template Value<std::vector<std::size_t>>(varValue,std::string(" [Type=vector<std::size_t>]"),defaultedValue,emptyValue);
|
||||
|
||||
// bool
|
||||
if (is_this_type<bool>(varValue))
|
||||
return T::template Value<bool>(varValue,std::string(" [Type=bool]"),defaultedValue,emptyValue);
|
||||
|
||||
// std::vector bool
|
||||
if (is_this_type<std::vector<bool>>(varValue))
|
||||
return T::template Value<std::vector<bool>>(varValue,std::string(" [Type=vector<bool>]"),defaultedValue,emptyValue);
|
||||
|
||||
//////////////////////////////// boost types
|
||||
// boost::filesystem::path
|
||||
|
|
Loading…
Reference in New Issue
Block a user