Revision
15502
Author
mrene
Date
2009-11-17 15:29:33 -0600 (Tue, 17 Nov 2009)

Log Message

mod_Logfile: add uuid parameter to prefix log files by the call's uuid

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c (15501 => 15502)


--- freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c	2009-11-17 20:18:43 UTC (rev 15501)
+++ freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c	2009-11-17 21:29:33 UTC (rev 15502)
@@ -57,6 +57,7 @@
 	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 @@
 		}
 
 		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 @@
 				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;
 			}
 		}
 	}