Commit 7696e1d2 authored by Guillaume Roguez's avatar Guillaume Roguez

logger: add macro set without linefeed at end

This patch adds logging macros:

RING_XERR
RING_XWARN
RING_XINFO
RING_XDBG

Acting like thus w/o 'X' but w/o a linefeed at end of message.

Change-Id: Ia4505e25354bbe2d6ddd96992e4f2f906025aa86
Tuleap: #547
parent 7bcb447b
......@@ -177,9 +177,8 @@ vlogger(const int level, const char *format, va_list ap)
vfprintf(stderr, format, ap);
#ifndef _WIN32
fputs(END_COLOR"\n", stderr);
fputs(END_COLOR, stderr);
#else
fputs("\n", stderr);
SetConsoleTextAttribute(hConsole, saved_attributes);
#endif
......
......@@ -64,6 +64,9 @@ void strErr();
#define STR(EXP) #EXP
#define XSTR(X) STR(X)
// Line return char in a string
#define ENDL "\n"
// Do not remove the "| " in following without modifying vlogger() code
#define LOG_FORMAT(M, ...) FILE_NAME ":" XSTR(__LINE__) "| " M, ##__VA_ARGS__
......@@ -112,10 +115,15 @@ void strErr();
#endif /* __ANDROID__ _WIN32 */
#define RING_ERR(M, ...) LOGGER(M, LOG_ERR, ##__VA_ARGS__)
#define RING_WARN(M, ...) LOGGER(M, LOG_WARNING, ##__VA_ARGS__)
#define RING_INFO(M, ...) LOGGER(M, LOG_INFO, ##__VA_ARGS__)
#define RING_DBG(M, ...) LOGGER(M, LOG_DEBUG, ##__VA_ARGS__)
#define RING_ERR(M, ...) LOGGER(M ENDL, LOG_ERR, ##__VA_ARGS__)
#define RING_WARN(M, ...) LOGGER(M ENDL, LOG_WARNING, ##__VA_ARGS__)
#define RING_INFO(M, ...) LOGGER(M ENDL, LOG_INFO, ##__VA_ARGS__)
#define RING_DBG(M, ...) LOGGER(M ENDL, LOG_DEBUG, ##__VA_ARGS__)
#define RING_XERR(M, ...) LOGGER(M, LOG_ERR, ##__VA_ARGS__)
#define RING_XWARN(M, ...) LOGGER(M, LOG_WARNING, ##__VA_ARGS__)
#define RING_XINFO(M, ...) LOGGER(M, LOG_INFO, ##__VA_ARGS__)
#define RING_XDBG(M, ...) LOGGER(M, LOG_DEBUG, ##__VA_ARGS__)
#ifdef __cplusplus
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment