Logging: log the number of messages in room with the message-syslog domain
[citadel.git] / citadel / msgbase.h
index 99b1cc0f838d69f6487333a6ea265d20102a3dec..f74c64b734590c51bea2d4c9ce2733c6b20ada2b 100644 (file)
@@ -260,6 +260,20 @@ ReadAsyncMsg *NewAsyncMsg(const char *terminator,  /* token signalling EOT */
 eReadState CtdlReadMessageBodyAsync(AsyncIO *IO);
 void DeleteAsyncMsg(ReadAsyncMsg **Msg);
 
+extern int MessageDebugEnabled;
+
+#define MSGDBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (MessageDebugEnabled != 0))
+#define CCCID CCC->cs_pid
+#define MSG_syslog(LEVEL, FORMAT, ...)                 \
+       MSGDBGLOG(LEVEL) syslog(LEVEL,                  \
+                               "CC[%d]" FORMAT,        \
+                               CCCID, __VA_ARGS__)
+
+#define MSGM_syslog(LEVEL, FORMAT)                     \
+       MSGDBGLOG(LEVEL) syslog(LEVEL,                  \
+                               "CC[%d]" FORMAT,        \
+                               CCCID)
+
 
 
 #endif /* MSGBASE_H */