include/dmlite/cpp/utils/logger.h File Reference
#include <syslog.h>
#include <pthread.h>
#include <sstream>
#include <string>
#include <map>
#include <vector>
Go to the source code of this file.
Classes |
class | Logger |
Defines |
#define | dpm_strerror_r(errnum, buf, buflen) |
#define | SSTR(message) static_cast<std::ostringstream&>(std::ostringstream().flush() << message).str() |
#define | Log(lvl, mymask, where, what) |
#define | Err(where, what) |
Functions |
void | LogCfgParm (int lvl, Logger::bitmask mymask, std::string where, std::string key, std::string value) |
Define Documentation
#define dpm_strerror_r |
( |
errnum, |
|
|
buf, |
|
|
buflen |
|
) |
|
Value:if (buflen > 0) { \
int old_errno = errno, cur_errno = errnum, rc; \
errno = 0; \
rc = strerror_r(cur_errno, buf, buflen); \
switch (rc) { \
case 0: \
case ERANGE: \
break; \
case EINVAL: \
snprintf(buf, buflen, "Unknown error %d", errnum); \
buf[buflen-1] = '\0'; \
break; \
} \
errno = old_errno; \
}
#define Err |
( |
where, |
|
|
what |
|
) |
|
Value:do{ \
std::ostringstream outs; \
outs << "{" << pthread_self() << "}" << "!!! dmlite " << where << " " << __func__ << " : " << what; \
Logger::get()->log((Logger::Level)0, outs.str()); \
}while(0)
#define Log |
( |
lvl, |
|
|
mymask, |
|
|
where, |
|
|
what |
|
) |
|
Value:do{ \
if (Logger::get()->getLevel() >= lvl && Logger::get()->isLogged(mymask)) \
{ \
std::ostringstream outs; \
outs << "{" << pthread_self() << "}" << "[" << lvl << "] dmlite " << where << " " << __func__ << " : " << what; \
Logger::get()->log((Logger::Level)lvl, outs.str()); \
} \
}while(0) \
#define SSTR |
( |
message |
|
) |
static_cast<std::ostringstream&>(std::ostringstream().flush() << message).str() |
Function Documentation
void LogCfgParm |
( |
int |
lvl, |
|
|
Logger::bitmask |
mymask, |
|
|
std::string |
where, |
|
|
std::string |
key, |
|
|
std::string |
value | |
|
) |
| | |