[DEV] update Log interafce
This commit is contained in:
parent
d0653f8e25
commit
10d5116851
12
etk/debug.h
12
etk/debug.h
@ -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)
|
||||
|
11
etk/log.h
11
etk/log.h
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user