diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-07-23 12:53:08 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-07-23 12:53:08 +0100 |
commit | fe79d8c5a39f2b717f78cc3f3ef21b3cfc46500b (patch) | |
tree | c84e6a5d4c5cd78a7a2cc3c7adbc7af5d0541682 /src/libutil/logger.h | |
parent | e0483657ff6cf1adc828ccce457814d61fe90a0d (diff) | |
download | rspamd-fe79d8c5a39f2b717f78cc3f3ef21b3cfc46500b.tar.gz rspamd-fe79d8c5a39f2b717f78cc3f3ef21b3cfc46500b.zip |
Revert "Unify code style."
This reverts commit e0483657ff6cf1adc828ccce457814d61fe90a0d.
Diffstat (limited to 'src/libutil/logger.h')
-rw-r--r-- | src/libutil/logger.h | 80 |
1 files changed, 22 insertions, 58 deletions
diff --git a/src/libutil/logger.h b/src/libutil/logger.h index 8d4b3763b..4b1c74410 100644 --- a/src/libutil/logger.h +++ b/src/libutil/logger.h @@ -1,24 +1,21 @@ #ifndef RSPAMD_LOGGER_H #define RSPAMD_LOGGER_H -#include "cfg_file.h" #include "config.h" +#include "cfg_file.h" #include "radix.h" #include "util.h" -typedef void (*rspamd_log_func_t)(const gchar * log_domain, - const gchar *function, - GLogLevelFlags log_level, const gchar * message, - gboolean forced, gpointer arg); +typedef void (*rspamd_log_func_t)(const gchar * log_domain, const gchar *function, + GLogLevelFlags log_level, const gchar * message, + gboolean forced, gpointer arg); typedef struct rspamd_logger_s rspamd_logger_t; /** * Init logger */ -void rspamd_set_logger (struct rspamd_config *cfg, - GQuark ptype, - struct rspamd_main *main); +void rspamd_set_logger (struct rspamd_config *cfg, GQuark ptype, struct rspamd_main *main); /** * Open log file or initialize other structures */ @@ -58,33 +55,28 @@ void flush_log_buf (rspamd_logger_t *logger); * Log function that is compatible for glib messages */ void rspamd_glib_log_function (const gchar *log_domain, - GLogLevelFlags log_level, const gchar *message, gpointer arg); + GLogLevelFlags log_level, const gchar *message, gpointer arg); /** * Function with variable number of arguments support */ void rspamd_common_log_function (rspamd_logger_t *logger, - GLogLevelFlags log_level, const gchar *function, const gchar *fmt, ...); + GLogLevelFlags log_level, const gchar *function, const gchar *fmt, ...); void rspamd_common_logv (rspamd_logger_t *logger, - GLogLevelFlags log_level, - const gchar *function, - const gchar *fmt, - va_list args); + GLogLevelFlags log_level, const gchar *function, const gchar *fmt, va_list args); /** * Conditional debug function */ void rspamd_conditional_debug (rspamd_logger_t *logger, - rspamd_inet_addr_t *addr, const gchar *function, const gchar *fmt, ...); + rspamd_inet_addr_t *addr, const gchar *function, const gchar *fmt, ...) ; /** * Function with variable number of arguments support that uses static default logger */ -void rspamd_default_log_function (GLogLevelFlags log_level, - const gchar *function, - const gchar *fmt, - ...); +void rspamd_default_log_function (GLogLevelFlags log_level, const gchar *function, + const gchar *fmt, ...); /** * Varargs version of default log function @@ -93,10 +85,7 @@ void rspamd_default_log_function (GLogLevelFlags log_level, * @param fmt * @param args */ -void rspamd_default_logv (GLogLevelFlags log_level, - const gchar *function, - const gchar *fmt, - va_list args); +void rspamd_default_logv (GLogLevelFlags log_level, const gchar *function, const gchar *fmt, va_list args); /** * Temporary turn on debug @@ -112,42 +101,17 @@ void rspamd_log_nodebug (rspamd_logger_t *logger); /* Logging in postfix style */ #if defined(RSPAMD_MAIN) -#define msg_err(...) rspamd_common_log_function (rspamd_main->logger, \ - G_LOG_LEVEL_CRITICAL, \ - __FUNCTION__, \ - __VA_ARGS__) -#define msg_warn(...) rspamd_common_log_function (rspamd_main->logger, \ - G_LOG_LEVEL_WARNING, \ - __FUNCTION__, \ - __VA_ARGS__) -#define msg_info(...) rspamd_common_log_function (rspamd_main->logger, \ - G_LOG_LEVEL_INFO, \ - __FUNCTION__, \ - __VA_ARGS__) -#define msg_debug(...) rspamd_conditional_debug (rspamd_main->logger, \ - NULL, \ - __FUNCTION__, \ - __VA_ARGS__) -#define debug_task(...) rspamd_conditional_debug (rspamd_main->logger, \ - &task->from_addr, \ - __FUNCTION__, \ - __VA_ARGS__) +#define msg_err(...) rspamd_common_log_function(rspamd_main->logger, G_LOG_LEVEL_CRITICAL, __FUNCTION__, __VA_ARGS__) +#define msg_warn(...) rspamd_common_log_function(rspamd_main->logger, G_LOG_LEVEL_WARNING, __FUNCTION__, __VA_ARGS__) +#define msg_info(...) rspamd_common_log_function(rspamd_main->logger, G_LOG_LEVEL_INFO, __FUNCTION__, __VA_ARGS__) +#define msg_debug(...) rspamd_conditional_debug(rspamd_main->logger, NULL, __FUNCTION__, __VA_ARGS__) +#define debug_task(...) rspamd_conditional_debug(rspamd_main->logger, &task->from_addr, __FUNCTION__, __VA_ARGS__) #else -#define msg_err(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \ - __FUNCTION__, \ - __VA_ARGS__) -#define msg_warn(...) rspamd_default_log_function (G_LOG_LEVEL_WARNING, \ - __FUNCTION__, \ - __VA_ARGS__) -#define msg_info(...) rspamd_default_log_function (G_LOG_LEVEL_INFO, \ - __FUNCTION__, \ - __VA_ARGS__) -#define msg_debug(...) rspamd_default_log_function (G_LOG_LEVEL_DEBUG, \ - __FUNCTION__, \ - __VA_ARGS__) -#define debug_task(...) rspamd_default_log_function (G_LOG_LEVEL_DEBUG, \ - __FUNCTION__, \ - __VA_ARGS__) +#define msg_err(...) rspamd_default_log_function(G_LOG_LEVEL_CRITICAL, __FUNCTION__, __VA_ARGS__) +#define msg_warn(...) rspamd_default_log_function(G_LOG_LEVEL_WARNING, __FUNCTION__, __VA_ARGS__) +#define msg_info(...) rspamd_default_log_function(G_LOG_LEVEL_INFO, __FUNCTION__, __VA_ARGS__) +#define msg_debug(...) rspamd_default_log_function(G_LOG_LEVEL_DEBUG, __FUNCTION__, __VA_ARGS__) +#define debug_task(...) rspamd_default_log_function(G_LOG_LEVEL_DEBUG, __FUNCTION__, __VA_ARGS__) #endif #endif |