13 #define SSTR(message) static_cast<std::ostringstream&>(std::ostringstream().flush() << message).str()
15 #define Log(lvl, mymask, where, what) \
17 if (Logger::get()->getLevel() >= lvl && Logger::get()->isLogged(mymask)) \
19 std::ostringstream outs; \
20 outs << "{" << pthread_self() << "}" << "[" << lvl << "] dmlite " << where << " " << __func__ << " : " << what; \
21 Logger::get()->log((Logger::Level)lvl, outs.str()); \
26 #define Err(where, what) \
28 std::ostringstream outs; \
29 outs << "{" << pthread_self() << "}" << "!!! dmlite " << where << " " << __func__ << " : " << what; \
30 Logger::get()->log((Logger::Level)0, outs.str()); \
115 void log(
Level lvl, std::string
const & msg)
const;
static void set(Logger *inst)
Definition: logger.h:73
static bitmask unregistered
Definition: logger.h:45
void registerComponents(std::vector< component > const &components)
std::map< component, bitmask > mapping
component name to bitmask mapping
Definition: logger.h:160
bitmask getMask(component const &comp)
static Logger * instance
Definition: logger.h:63
bool isLogged(bitmask m) const
Definition: logger.h:91
int size
number of components that were assigned with a bitmask
Definition: logger.h:156
void setLogged(component const &comp, bool tobelogged)
unsigned long long bitmask
typedef for a bitmask (long long)
Definition: logger.h:41
short level
current log level
Definition: logger.h:154
void logAll()
Definition: logger.h:121
Logger & operator=(Logger const &)
void setLevel(Level lvl)
Definition: logger.h:85
bitmask mask
global bitmask with all registered components
Definition: logger.h:158
std::string component
typedef for a component name (std:string)
Definition: logger.h:43
void LogCfgParm(int lvl, Logger::bitmask mymask, std::string where, std::string key, std::string value)
void registerComponent(component const &comp)
void log(Level lvl, std::string const &msg) const
Level
Definition: logger.h:50
Logger()
Private constructor.
short getLevel() const
Definition: logger.h:79
static char * unregisteredname
Definition: logger.h:46
static int getStackTrace(std::string &s)