mod_syslog: add uuid logging support

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16187 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2010-01-06 17:56:40 +00:00
parent 42f8ffca56
commit a4b094ddc5

View File

@ -50,6 +50,7 @@ static struct {
char *ident; char *ident;
char *format; char *format;
int facility; int facility;
switch_bool_t log_uuid;
} globals; } globals;
struct _facility_table_entry { struct _facility_table_entry {
@ -146,7 +147,11 @@ static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_l
/* don't log blank lines */ /* don't log blank lines */
if (!zstr(node->data) && (strspn(node->data, " \t\r\n") < strlen(node->data))) { if (!zstr(node->data) && (strspn(node->data, " \t\r\n") < strlen(node->data))) {
syslog(syslog_level, "%s", node->data); if (globals.log_uuid && !zstr(node->userdata)) {
syslog(syslog_level, "%s %s", node->userdata, node->data);
} else {
syslog(syslog_level, "%s", node->data);
}
} }
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
@ -182,6 +187,8 @@ static switch_status_t load_config(void)
if (log_level == SWITCH_LOG_INVALID) { if (log_level == SWITCH_LOG_INVALID) {
log_level = SWITCH_LOG_WARNING; log_level = SWITCH_LOG_WARNING;
} }
} else if (!strcasecmp(var, "uuid")) {
globals.log_uuid = switch_true(val);
} }
} }
} }