]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 3 Oct 2007 01:03:10 +0000 (01:03 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 3 Oct 2007 01:03:10 +0000 (01:03 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5782 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/xml_cdr.conf.xml
src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c

index 70347ea5e78fb5ac339f150929f260824872f2a8..df5422a24ae2286b5f866ac7cf84e5485e35bccb 100644 (file)
     <!-- delay between retries in seconds, default is 5 seconds -->\r
     <!-- <param name="delay" value="1"/> -->\r
 \r
-    <!-- optional: full path to the error log dir for failed web posts if not specified its <freeswitch>/logs/xml_cdr_curl -->\r
-    <!-- <param name="errLogDir" value="/tmp"/> -->\r
-\r
     <!-- optional: if not present we do not log every record to disk -->\r
-    <!-- per original code base /xml_cdr is appended to the directory name -->\r
-    <!-- defined but blank value will default to freeswitchdir/log -->\r
-    <param name="logDir" value=""/>\r
+    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->\r
+    <param name="log-dir" value=""/>\r
+\r
+    <!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->\r
+    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->\r
+    <!-- <param name="err-log-dir" value="/tmp"/> -->\r
 \r
   </settings>\r
 </configuration>\r
index a8fa90859a8b40439dc291dacbdb53bef2d6dda8..4a79d1ab54c3027c614c8b7b08f3dddc68990478 100644 (file)
@@ -230,9 +230,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
                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 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
                        } 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) {