mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Add FlatBuffers & MessagePack examples
- Add FlatBuffers serialization example to Tutorial 3 - Add MessagePack serialization example to Tutorial 3 - Performance improvements in Boost serialization example - Use `GetEntriesFast()` for FairTestDetectorRecoTask - Use `Clear()` instead of `Delete()` in MQ parts of Tutorial 3 - Fix CMake variables from preventing compilation without nanomsg. - create macro/data directories in install directory - Get rid of data duplication in fill_parameters.C - Various cleanups and fixes
This commit is contained in:
committed by
Mohammad Al-Turany
parent
f1abb9ecdd
commit
82ab7670a9
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#ifndef LOGGER_DEF_H
|
||||
#define LOGGER_DEF_H
|
||||
#define LOGGER_DEF_H
|
||||
|
||||
#include <array>
|
||||
#include <fstream>
|
||||
@@ -34,28 +34,25 @@ namespace fairmq
|
||||
ERROR,
|
||||
STATE,
|
||||
NOLOG
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
static const std::array<std::string, 8> g_LogSeverityLevelString
|
||||
{
|
||||
{
|
||||
"TRACE",
|
||||
"DEBUG",
|
||||
"DEBUG",
|
||||
"RESULTS",
|
||||
"INFO",
|
||||
"WARN",
|
||||
"ERROR",
|
||||
"STATE",
|
||||
"NOLOG"
|
||||
"INFO",
|
||||
"WARN",
|
||||
"ERROR",
|
||||
"STATE",
|
||||
"NOLOG"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
namespace color
|
||||
namespace color
|
||||
{
|
||||
enum code
|
||||
enum code
|
||||
{
|
||||
FG_BLACK = 30,
|
||||
FG_RED = 31,
|
||||
@@ -94,25 +91,24 @@ typedef fairmq::severity_level custom_severity_level;
|
||||
struct tag_console;
|
||||
struct tag_file;
|
||||
|
||||
|
||||
// overload operator for console output
|
||||
inline boost::log::formatting_ostream& operator<<
|
||||
(
|
||||
boost::log::formatting_ostream& strm,
|
||||
boost::log::to_log_manip< custom_severity_level, tag_console > const& manip
|
||||
boost::log::to_log_manip<custom_severity_level, tag_console> const& manip
|
||||
)
|
||||
{
|
||||
custom_severity_level level = manip.get();
|
||||
std::size_t idx=static_cast< std::size_t >(level);
|
||||
if ( idx < fairmq::g_LogSeverityLevelString.size() )
|
||||
std::size_t idx = static_cast<std::size_t>(level);
|
||||
if (idx < fairmq::g_LogSeverityLevelString.size())
|
||||
{
|
||||
//strm <<" idx = "<<idx <<" ";
|
||||
// strm << " idx = " << idx << " ";
|
||||
switch (level)
|
||||
{
|
||||
case custom_severity_level::TRACE :
|
||||
strm << write_in<fairmq::color::FG_BLUE>(fairmq::g_LogSeverityLevelString.at(idx));
|
||||
break;
|
||||
|
||||
|
||||
case custom_severity_level::DEBUG :
|
||||
strm << write_in<fairmq::color::FG_BLUE>(fairmq::g_LogSeverityLevelString.at(idx));
|
||||
break;
|
||||
@@ -123,34 +119,32 @@ inline boost::log::formatting_ostream& operator<<
|
||||
|
||||
case custom_severity_level::INFO :
|
||||
strm << write_in<fairmq::color::FG_GREEN>(fairmq::g_LogSeverityLevelString.at(idx));
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case custom_severity_level::WARN :
|
||||
strm << write_in<fairmq::color::FG_YELLOW>(fairmq::g_LogSeverityLevelString.at(idx));
|
||||
break;
|
||||
|
||||
case custom_severity_level::STATE :
|
||||
strm << write_in<fairmq::color::FG_MAGENTA>(fairmq::g_LogSeverityLevelString.at(idx));
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case custom_severity_level::ERROR :
|
||||
strm << write_in<fairmq::color::FG_RED>(fairmq::g_LogSeverityLevelString.at(idx));
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case custom_severity_level::NOLOG :
|
||||
strm << write_in<fairmq::color::FG_DEFAULT>(fairmq::g_LogSeverityLevelString.at(idx));
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
strm << write_in<fairmq::color::FG_RED>("Unknown log level ")
|
||||
<< "(int level = "<<static_cast< int >(level)
|
||||
<<")";
|
||||
strm << write_in<fairmq::color::FG_RED>("Unknown log level ")
|
||||
<< "(int level = " << static_cast<int>(level) << ")";
|
||||
}
|
||||
return strm;
|
||||
}
|
||||
@@ -159,27 +153,21 @@ inline boost::log::formatting_ostream& operator<<
|
||||
inline boost::log::formatting_ostream& operator<<
|
||||
(
|
||||
boost::log::formatting_ostream& strm,
|
||||
boost::log::to_log_manip< custom_severity_level, tag_file > const& manip
|
||||
boost::log::to_log_manip<custom_severity_level, tag_file> const& manip
|
||||
)
|
||||
{
|
||||
custom_severity_level level = manip.get();
|
||||
std::size_t idx=static_cast< std::size_t >(level);
|
||||
if ( idx < fairmq::g_LogSeverityLevelString.size() )
|
||||
std::size_t idx = static_cast<std::size_t>(level);
|
||||
if (idx < fairmq::g_LogSeverityLevelString.size())
|
||||
{
|
||||
strm << fairmq::g_LogSeverityLevelString.at(idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
strm << write_in<fairmq::color::FG_RED>("Unknown log level ")
|
||||
<< "(int level = "<<static_cast< int >(level)
|
||||
<<")";
|
||||
strm << write_in<fairmq::color::FG_RED>("Unknown log level ")
|
||||
<< "(int level = " << static_cast<int>(level) << ")";
|
||||
}
|
||||
return strm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* LOGGER_DEF_H */
|
||||
|
||||
#endif /* LOGGER_DEF_H */
|
||||
|
Reference in New Issue
Block a user