IMAP: make debug logging configurable.
[citadel.git] / citadel / modules / imap / serv_imap.h
index 8113f675bb37b75fec8f5bfed9f57d550c69eded..371dbeb2ef3e772782ca6a26c4a7b47b6ff69727 100644 (file)
@@ -101,8 +101,22 @@ enum {
 
 #define FDELIM '\\'
 
+extern int IMAPDebugEnabled;
 
 #define IMAP ((citimap *)CC->session_specific_data)
+#define CCCIMAP ((citimap *)CCC->session_specific_data)
+
+#define IMAPDBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (IMAPDebugEnabled != 0))
+#define CCCID CCC->cs_pid
+#define IMAP_syslog(LEVEL, FORMAT, ...)                        \
+       IMAPDBGLOG(LEVEL) syslog(LEVEL,                 \
+                                "IMAPCC[%d] " FORMAT,  \
+                                CCCID, __VA_ARGS__)
+
+#define IMAPM_syslog(LEVEL, FORMAT)                    \
+       IMAPDBGLOG(LEVEL) syslog(LEVEL,                 \
+                                "IMAPCC[%d] " FORMAT,  \
+                                CCCID)
 
 #define I_FLAG_NONE          (0)
 #define I_FLAG_LOGGED_IN  (1<<0)