[Freeswitch-svn] [commit] r5782 - in freeswitch/trunk: conf src/mod/xml_int/mod_xml_cdr

Freeswitch SVN anthm at freeswitch.org
Tue Oct 2 21:03:10 EDT 2007


Author: anthm
Date: Tue Oct  2 21:03:10 2007
New Revision: 5782

Modified:
   freeswitch/trunk/conf/xml_cdr.conf.xml
   freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c

Log:
cleanup

Modified: freeswitch/trunk/conf/xml_cdr.conf.xml
==============================================================================
--- freeswitch/trunk/conf/xml_cdr.conf.xml	(original)
+++ freeswitch/trunk/conf/xml_cdr.conf.xml	Tue Oct  2 21:03:10 2007
@@ -12,13 +12,13 @@
     <!-- delay between retries in seconds, default is 5 seconds -->
     <!-- <param name="delay" value="1"/> -->
 
-    <!-- optional: full path to the error log dir for failed web posts if not specified its <freeswitch>/logs/xml_cdr_curl -->
-    <!-- <param name="errLogDir" value="/tmp"/> -->
-
     <!-- optional: if not present we do not log every record to disk -->
-    <!-- per original code base /xml_cdr is appended to the directory name -->
-    <!-- defined but blank value will default to freeswitchdir/log -->
-    <param name="logDir" value=""/>
+    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->
+    <param name="log-dir" value=""/>
+
+    <!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
+    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
+    <!-- <param name="err-log-dir" value="/tmp"/> -->
 
   </settings>
 </configuration>

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	Tue Oct  2 21:03:10 2007
@@ -230,9 +230,6 @@
 		return SWITCH_STATUS_TERM;
 	}
 
-	globals.log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir);
-	globals.err_log_dir = strdup(globals.log_dir);
-	
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -247,21 +244,34 @@
 			} else if (!strcasecmp(var, "retries")) {
 				globals.retries = (uint32_t) atoi(val);
 			} else if (!strcasecmp(var, "log-dir")) {
-				switch_safe_free(globals.log_dir);
-				if (switch_is_file_path(val)) {
-					globals.log_dir = strdup(val);
+				if (switch_strlen_zero(val)) {
+					globals.log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir);
 				} else {
-					globals.log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val);
+					if (switch_is_file_path(val)) {
+						globals.log_dir = strdup(val);
+					} else {
+						globals.log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val);
+					}
 				}
 			} else if (!strcasecmp(var, "err-log-dir")) {
-				switch_safe_free(globals.err_log_dir);
-				if (switch_is_file_path(val)) {
-					globals.err_log_dir = strdup(val);
+				if (switch_strlen_zero(val)) {
+					globals.err_log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir);
 				} else {
-					globals.err_log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val);
+					if (switch_is_file_path(val)) {
+						globals.err_log_dir = strdup(val);
+					} else {
+						globals.err_log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val);
+					}
 				}
 			}
 
+			if (switch_strlen_zero(globals.err_log_dir)) {
+				if (!switch_strlen_zero(globals.log_dir)) {
+					globals.err_log_dir = strdup(globals.log_dir);
+				} else {
+					globals.err_log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir);
+				}
+			}
 		}
 	}
 	if(globals.retries < 0) {



More information about the Freeswitch-svn mailing list