From 5d55996fa007399b78789a08d41b63ec58d61aff Mon Sep 17 00:00:00 2001
From: Mathieu Rene <mrene@avgs.ca>
Date: Tue, 17 Nov 2009 21:29:33 +0000
Subject: [PATCH] mod_Logfile: add uuid parameter to prefix log files by the
 call's uuid

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15502 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 src/mod/loggers/mod_logfile/mod_logfile.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/mod/loggers/mod_logfile/mod_logfile.c b/src/mod/loggers/mod_logfile/mod_logfile.c
index e859553061..8e5355dbb7 100644
--- a/src/mod/loggers/mod_logfile/mod_logfile.c
+++ b/src/mod/loggers/mod_logfile/mod_logfile.c
@@ -57,6 +57,7 @@ struct logfile_profile {
 	switch_file_t *log_afd;
 	switch_hash_t *log_hash;
 	uint32_t all_level;
+	switch_bool_t log_uuid;
 };
 
 typedef struct logfile_profile logfile_profile_t;
@@ -228,7 +229,13 @@ static switch_status_t process_node(const switch_log_node_t *node, switch_log_le
 		}
 
 		if (ok) {
-			mod_logfile_raw_write(profile, node->data);
+			if (profile->log_uuid && !zstr(node->userdata)) {
+				char buf[2048];
+				switch_snprintf(buf, sizeof(buf), "%s %s", node->userdata, node->data);	
+				mod_logfile_raw_write(profile, buf);
+			} else {
+				mod_logfile_raw_write(profile, node->data);
+			}
 		}
 
 	}
@@ -264,6 +271,8 @@ static switch_status_t load_profile(switch_xml_t xml)
 				if (new_profile->roll_size < 0) {
 					new_profile->roll_size = 0;
 				}
+			} else if (!strcmp(var, "uuid") && switch_true(val)) {
+				new_profile->log_uuid = SWITCH_TRUE;
 			}
 		}
 	}