[asterisk-commits] elguero: branch 11 r388605 - /branches/11/main/logger.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 13 16:17:58 CDT 2013


Author: elguero
Date: Mon May 13 16:17:44 2013
New Revision: 388605

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388605
Log:
Fix Missing CALL-ID When Logging Through Syslog

The CALL-ID (ie [C-00000074]) is missing when logging to syslog.  This was just
an oversight when this feature was added.

* Add CALL-IDs when using syslog

(closes issue ASTERISK-21430)
Reported by: Nikola Ciprich
Tested by: Nikola Ciprich, Michael L. Young
Patches:
    asterisk-21430-syslog-callid_trunk.diff by Michael L. Young (license 5026)

Review: https://reviewboard.asterisk.org/r/2526/

Modified:
    branches/11/main/logger.c

Modified: branches/11/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/logger.c?view=diff&rev=388605&r1=388604&r2=388605
==============================================================================
--- branches/11/main/logger.c (original)
+++ branches/11/main/logger.c Mon May 13 16:17:44 2013
@@ -997,6 +997,13 @@
 {
 	char buf[BUFSIZ];
 	int syslog_level = ast_syslog_priority_from_loglevel(msg->level);
+	char call_identifier_str[13];
+
+	if (msg->callid) {
+		snprintf(call_identifier_str, sizeof(call_identifier_str), "[C-%08x]", msg->callid->call_identifier);
+	} else {
+		call_identifier_str[0] = '\0';
+	}
 
 	if (syslog_level < 0) {
 		/* we are locked here, so cannot ast_log() */
@@ -1004,8 +1011,8 @@
 		return;
 	}
 
-	snprintf(buf, sizeof(buf), "%s[%d]: %s:%d in %s: %s",
-		 levels[msg->level], msg->lwp, msg->file, msg->line, msg->function, msg->message);
+	snprintf(buf, sizeof(buf), "%s[%d]%s: %s:%d in %s: %s",
+		 levels[msg->level], msg->lwp, call_identifier_str, msg->file, msg->line, msg->function, msg->message);
 
 	term_strip(buf, buf, strlen(buf) + 1);
 	syslog(syslog_level, "%s", buf);




More information about the asterisk-commits mailing list