diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-01-20 12:39:37 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-01-20 12:39:37 +0000 |
commit | ef80118079258610197e5a1432e1a14610fb6006 (patch) | |
tree | cb38a616b48ab78ece45a1ec8cda49c190ce6839 /src/libutil/logger.h | |
parent | cf58caf06a1813eff48363b559ad18fb01ddaa90 (diff) | |
download | rspamd-ef80118079258610197e5a1432e1a14610fb6006.tar.gz rspamd-ef80118079258610197e5a1432e1a14610fb6006.zip |
[Project] Add fast debug logging infrastructure
Diffstat (limited to 'src/libutil/logger.h')
-rw-r--r-- | src/libutil/logger.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libutil/logger.h b/src/libutil/logger.h index ea7611cd6..9c9ca209a 100644 --- a/src/libutil/logger.h +++ b/src/libutil/logger.h @@ -96,12 +96,34 @@ void rspamd_common_logv (rspamd_logger_t *logger, gint level_flags, const gchar *fmt, va_list args); /** + * Add new logging module, returns module ID + * @param mod + * @return + */ +guint rspamd_logger_add_debug_module (const gchar *mod); + +/* + * Macro to use for faster debug modules + */ +#define INIT_LOG_MODULE(mname) \ + static guint mname##_log_id = (guint)-1; \ + static RSPAMD_CONSTRUCTOR(mname##_log_init) { \ + mname##_log_id = rspamd_logger_add_debug_module(#mname); \ +} + +void rspamd_logger_configure_modules (GHashTable *mods_enabled); + +/** * Conditional debug function */ void rspamd_conditional_debug (rspamd_logger_t *logger, rspamd_inet_addr_t *addr, const gchar *module, const gchar *id, const gchar *function, const gchar *fmt, ...); +void rspamd_conditional_debug_fast (rspamd_logger_t *logger, + rspamd_inet_addr_t *addr, guint mod_id, const gchar *id, + const gchar *function, const gchar *fmt, ...); + /** * Function with variable number of arguments support that uses static default logger */ |