[DEV] update Log interafce

This commit is contained in:
Edouard DUPIN 2015-03-25 21:14:12 +01:00
parent d0653f8e25
commit 10d5116851
2 changed files with 13 additions and 10 deletions

View File

@ -16,16 +16,8 @@
namespace etk {
int32_t getLogId();
};
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
#define ETK_BASE(info,data) \
do { \
if (info <= etk::log::getLevel(etk::getLogId())) { \
std::stringbuf sb; \
std::ostream tmpStream(&sb); \
tmpStream << data; \
etk::log::logStream(etk::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
} \
} while(0)
#define ETK_BASE(info,data) TK_LOG_BASE(etk::getLogId(),info,data)
#define TK_CRITICAL(data) ETK_BASE(1, data)
#define TK_ERROR(data) ETK_BASE(2, data)

View File

@ -132,4 +132,15 @@ namespace etk {
#endif
#define __class__ (NULL)
// generic define for all logs::
#define TK_LOG_BASE(logId,info,data) \
do { \
if (info <= etk::log::getLevel(logId)) { \
std::stringbuf sb; \
std::ostream tmpStream(&sb); \
tmpStream << data; \
etk::log::logStream(logId, info, __LINE__, __class__, __func__, tmpStream); \
} \
} while(0)
#endif