Restructure logging internal. Add raw logging capability
This commit is contained in:
+16
-3
@@ -210,12 +210,18 @@ int uc_log_reopen_files(void);
|
||||
*/
|
||||
void uc_log_init(struct uc_log_modules *user_modules);
|
||||
|
||||
void uc_logf(int log_level, int module, const char *file, int line, const char *fmt, ...) __attribute__((format(printf, 5, 6)));
|
||||
void uc_logf(int log_level, int module, int raw,
|
||||
const char *file, int line, const char *fmt, ...)
|
||||
__attribute__((format(printf, 6, 7)));
|
||||
|
||||
#ifdef DEBUG
|
||||
# define UC_DEBUGF(mod, fmt, ...) uc_logf(UC_LL_DEBUG, mod, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
# define UC_DEBUGF(mod, fmt, ...)\
|
||||
uc_logf(UC_LL_DEBUG, mod,0 , __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
# define UC_DEBUGFR(mod, fmt, ...)\
|
||||
uc_logf(UC_LL_DEBUG, mod,1 , , __LINE__, fmt, ## __VA_ARGS__)
|
||||
#else
|
||||
# define UC_DEBUGF(mod, fmt, ...)
|
||||
# define UC_DEBUGFR(mod, fmt, ...)
|
||||
#endif
|
||||
|
||||
/** Main macro that should be used for logging.
|
||||
@@ -228,9 +234,16 @@ void uc_logf(int log_level, int module, const char *file, int line, const char *
|
||||
* @param fmt printf style format string
|
||||
* @param ... printf style arguments
|
||||
*/
|
||||
#define UC_LOGF(lvl, mod, fmt, ...) uc_logf(lvl, mod, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
#define UC_LOGF(lvl, mod, fmt, ...) \
|
||||
uc_logf(lvl, mod, 0, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
|
||||
|
||||
/** Raw logging ,Like UC_LOGF, but only prints the supplied
|
||||
* data, not timestamp, log level etc.
|
||||
*/
|
||||
#define UC_LOGFR(lvl, mod, fmt, ...) \
|
||||
uc_logf(lvl, mod, 1, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user