45std::string get_debug_log_line_prefix();
47static std::mutex bes_debug_log_mutex;
51#define BESDEBUG( x, y )
66#define BESDEBUG( x, y ) do { if( BESDebug::IsSet( x ) ) *(BESDebug::GetStrm()) << get_debug_log_line_prefix() << "["<< x << "] " << y ; } while( 0 )
70#define BESISDEBUG( x ) (false)
92#define BESISDEBUG( x ) BESDebug::IsSet( x )
101 using DebugMap = std::map<std::string, bool>;
103 static DebugMap _debug_map;
104 static std::ostream *_debug_strm;
105 static bool _debug_strm_created;
108 static const DebugMap &debug_map()
114 static void Set(
const std::string &flagName,
bool value);
128 auto i = _debug_map.find(flagName);
129 if (i == _debug_map.end()) {
130 auto a = _debug_map.find(
"all");
131 if (a == _debug_map.end()) {
132 _debug_map[flagName] =
false;
135 _debug_map[flagName] =
true;
145 static bool IsSet(
const std::string &flagName)
147 auto i = _debug_map.find(flagName);
148 if (i != _debug_map.end())
151 i = _debug_map.find(
"all");
153 if (i != _debug_map.end())
185 static void SetStrm(std::ostream *strm,
bool created)
187 if (_debug_strm_created && _debug_strm) {
188 _debug_strm->flush();
190 _debug_strm =
nullptr;
192 else if (_debug_strm) {
193 _debug_strm->flush();
196 _debug_strm = &std::cerr;
197 _debug_strm_created =
false;
201 _debug_strm_created = created;
205 static void SetUp(
const std::string &values);
206 static void Help(std::ostream &strm);
207 static bool IsContextName(
const std::string &name);
static void SetStrm(std::ostream *strm, bool created)
set the debug output stream to the specified stream
static void SetUp(const std::string &values)
Sets up debugging for the bes.
static void Register(const std::string &flagName)
register the specified debug flag
static bool IsSet(const std::string &flagName)
see if the debug context flagName is set to true
static void Help(std::ostream &strm)
Writes help information for so that developers know what can be set for debugging.
static std::ostream * GetStrm()
return the debug stream
static std::string GetOptionsString()
static void Set(const std::string &flagName, bool value)
set the debug context to the specified value