Convert logging to use UC_SRC_LOCATION

This commit is contained in:
Nils O. Selåsdal
2013-10-16 01:44:36 +02:00
parent 13567e3cd9
commit ee3dd22b0e
2 changed files with 14 additions and 15 deletions
+7 -6
View File
@@ -1,5 +1,6 @@
#ifndef UC_LOGGING_H_
#define UC_LOGGING_H_
#include "utils.h"
/** Logging functions.
* All logging functions except uc_log_init are thread safe,
@@ -268,14 +269,14 @@ int uc_log_reopen_files(void);
void uc_log_init(struct uc_log_modules *user_modules);
void uc_logf(int log_level, int module, int raw,
const char *file, int line, const char *fmt, ...)
__attribute__((format(printf, 6, 7)));
const char *location, const char *fmt, ...)
__attribute__((format(printf, 5, 6)));
#ifdef DEBUG
# define UC_DEBUGF(mod, fmt, ...)\
uc_logf(UC_LL_DEBUG, mod,0 , __FILE__, __LINE__, fmt, ## __VA_ARGS__)
uc_logf(UC_LL_DEBUG, mod,0 , UC_SRC_LOCATION fmt, ## __VA_ARGS__)
# define UC_DEBUGFR(mod, fmt, ...)\
uc_logf(UC_LL_DEBUG, mod,1 , __FILE__, __LINE__, fmt, ## __VA_ARGS__)
uc_logf(UC_LL_DEBUG, mod,1 , UC_SRC_LOCATION, fmt, ## __VA_ARGS__)
#else
# define UC_DEBUGF(mod, fmt, ...)
# define UC_DEBUGFR(mod, fmt, ...)
@@ -292,14 +293,14 @@ void uc_logf(int log_level, int module, int raw,
* @param ... printf style arguments
*/
#define UC_LOGF(lvl, mod, fmt, ...) \
uc_logf(lvl, mod, 0, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
uc_logf(lvl, mod, 0, UC_SRC_LOCATION, 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__)
uc_logf(lvl, mod, 1, UC_SRC_LOCATION, fmt, ## __VA_ARGS__)
#ifdef __cplusplus
}