Module: kamailio
Branch: master
Commit: 15153d5f528efa1238e6c8c6b1a5f91018ba06ef
URL:
https://github.com/kamailio/kamailio/commit/15153d5f528efa1238e6c8c6b1a5f91…
Author: Elena-Ramona Modroiu <ramona(a)asipto.com>
Committer: Elena-Ramona Modroiu <ramona(a)asipto.com>
Date: 2015-08-27T19:02:53+02:00
xlog: convenience functions for various log levels
- xinfo(), xnotice(), xwarn(), xerr(), xbug(), xcrit(), xalert()
---
Modified: modules/xlog/xlog.c
---
Diff:
https://github.com/kamailio/kamailio/commit/15153d5f528efa1238e6c8c6b1a5f91…
Patch:
https://github.com/kamailio/kamailio/commit/15153d5f528efa1238e6c8c6b1a5f91…
---
diff --git a/modules/xlog/xlog.c b/modules/xlog/xlog.c
index 61947af..efe2c8b 100644
--- a/modules/xlog/xlog.c
+++ b/modules/xlog/xlog.c
@@ -88,6 +88,13 @@ static int xlog_1(struct sip_msg*, char*, char*);
static int xlog_2(struct sip_msg*, char*, char*);
static int xlog_3(struct sip_msg*, char*, char*, char*);
static int xdbg(struct sip_msg*, char*, char*);
+static int xinfo(struct sip_msg*, char*, char*);
+static int xnotice(struct sip_msg*, char*, char*);
+static int xwarn(struct sip_msg*, char*, char*);
+static int xerr(struct sip_msg*, char*, char*);
+static int xbug(struct sip_msg*, char*, char*);
+static int xcrit(struct sip_msg*, char*, char*);
+static int xalert(struct sip_msg*, char*, char*);
static int xlogl_1(struct sip_msg*, char*, char*);
static int xlogl_2(struct sip_msg*, char*, char*);
@@ -138,6 +145,13 @@ static cmd_export_t cmds[]={
{"xlog", (cmd_function)xlog_2, 2, xlog_fixup, 0, ANY_ROUTE},
{"xlog", (cmd_function)xlog_3, 3, xlog3_fixup, 0, ANY_ROUTE},
{"xdbg", (cmd_function)xdbg, 1, xdbg_fixup, 0, ANY_ROUTE},
+ {"xinfo", (cmd_function)xinfo, 1, xdbg_fixup, 0, ANY_ROUTE},
+ {"xnotice",(cmd_function)xnotice, 1, xdbg_fixup, 0, ANY_ROUTE},
+ {"xwarn", (cmd_function)xwarn, 1, xdbg_fixup, 0, ANY_ROUTE},
+ {"xerr", (cmd_function)xerr, 1, xdbg_fixup, 0, ANY_ROUTE},
+ {"xbug", (cmd_function)xbug, 1, xdbg_fixup, 0, ANY_ROUTE},
+ {"xcrit", (cmd_function)xcrit, 1, xdbg_fixup, 0, ANY_ROUTE},
+ {"xalert", (cmd_function)xalert, 1, xdbg_fixup, 0, ANY_ROUTE},
{"xlogl", (cmd_function)xlogl_1, 1, xdbgl_fixup, 0, ANY_ROUTE},
{"xlogl", (cmd_function)xlogl_2, 2, xlogl_fixup, 0, ANY_ROUTE},
{"xlogl", (cmd_function)xlogl_3, 3, xlogl3_fixup,0, ANY_ROUTE},
@@ -391,6 +405,76 @@ static int xdbg(struct sip_msg* msg, char* frm, char* str2)
}
/**
+ * print log message to L_INFO level
+ */
+static int xinfo(struct sip_msg* msg, char* frm, char* str2)
+{
+ if(!is_printable(L_INFO))
+ return 1;
+ return xlog_helper(msg, (xl_msg_t*)frm, L_INFO, 0, NOFACILITY);
+}
+
+/**
+ * print log message to L_NOTICE level
+ */
+static int xnotice(struct sip_msg* msg, char* frm, char* str2)
+{
+ if(!is_printable(L_NOTICE))
+ return 1;
+ return xlog_helper(msg, (xl_msg_t*)frm, L_NOTICE, 0, NOFACILITY);
+}
+
+/**
+ * print log message to L_WARN level
+ */
+static int xwarn(struct sip_msg* msg, char* frm, char* str2)
+{
+ if(!is_printable(L_WARN))
+ return 1;
+ return xlog_helper(msg, (xl_msg_t*)frm, L_WARN, 0, NOFACILITY);
+}
+
+/**
+ * print log message to L_ERR level
+ */
+static int xerr(struct sip_msg* msg, char* frm, char* str2)
+{
+ if(!is_printable(L_ERR))
+ return 1;
+ return xlog_helper(msg, (xl_msg_t*)frm, L_ERR, 0, NOFACILITY);
+}
+
+/**
+ * print log message to L_BUG level
+ */
+static int xbug(struct sip_msg* msg, char* frm, char* str2)
+{
+ if(!is_printable(L_BUG))
+ return 1;
+ return xlog_helper(msg, (xl_msg_t*)frm, L_BUG, 0, NOFACILITY);
+}
+
+/**
+ * print log message to L_CRIT level
+ */
+static int xcrit(struct sip_msg* msg, char* frm, char* str2)
+{
+ if(!is_printable(L_CRIT2))
+ return 1;
+ return xlog_helper(msg, (xl_msg_t*)frm, L_CRIT2, 0, NOFACILITY);
+}
+
+/**
+ * print log message to L_ALERT level
+ */
+static int xalert(struct sip_msg* msg, char* frm, char* str2)
+{
+ if(!is_printable(L_ALERT))
+ return 1;
+ return xlog_helper(msg, (xl_msg_t*)frm, L_ALERT, 0, NOFACILITY);
+}
+
+/**
* print log message to L_DBG level along with cfg line
*/
static int xdbgl(struct sip_msg* msg, char* frm, char* str2)