[tor-commits] [tor/master] Improve logging of included config files

dgoulet at torproject.org dgoulet at torproject.org
Tue May 19 19:22:36 UTC 2020


commit cce16a939c63892b4e7a132c0df93c103d177620
Author: Daniel Pinto <danielpinto52 at gmail.com>
Date:   Wed May 6 23:34:32 2020 +0100

    Improve logging of included config files
---
 src/lib/encoding/confline.c                           | 5 ++---
 src/lib/fs/conffile.c                                 | 1 +
 src/test/conf_examples/empty_3/expected_log           | 2 +-
 src/test/conf_examples/include_1/expected_log         | 2 +-
 src/test/conf_examples/include_bug_31408/expected_log | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lib/encoding/confline.c b/src/lib/encoding/confline.c
index eb1a4e30f..613e4a00c 100644
--- a/src/lib/encoding/confline.c
+++ b/src/lib/encoding/confline.c
@@ -151,6 +151,8 @@ config_get_lines_aux(const char *string, config_line_t **result, int extended,
       if (allow_include && !strcmp(k, "%include") && handle_include) {
         tor_free(k);
         include_used = 1;
+        log_notice(LD_CONFIG, "Processing configuration path \"%s\" at "
+                   "recursion level %d.", v, recursion_level);
 
         config_line_t *include_list;
         if (handle_include(v, recursion_level, extended, &include_list,
@@ -161,9 +163,6 @@ config_get_lines_aux(const char *string, config_line_t **result, int extended,
           tor_free(v);
           return -1;
         }
-        log_notice(LD_CONFIG, "Included configuration file or "
-                   "directory at recursion level %d: \"%s\".",
-                   recursion_level, v);
         *next = include_list;
         if (list_last)
           next = &list_last->next;
diff --git a/src/lib/fs/conffile.c b/src/lib/fs/conffile.c
index 392b2f454..9583093c1 100644
--- a/src/lib/fs/conffile.c
+++ b/src/lib/fs/conffile.c
@@ -152,6 +152,7 @@ config_process_include(const char *path, int recursion_level, int extended,
 
   int rv = -1;
   SMARTLIST_FOREACH_BEGIN(config_files, const char *, config_file) {
+    log_notice(LD_CONFIG, "Including configuration file \"%s\".", config_file);
     config_line_t *included_config = NULL;
     config_line_t *included_config_last = NULL;
     if (config_get_included_config(config_file, recursion_level, extended,
diff --git a/src/test/conf_examples/empty_3/expected_log b/src/test/conf_examples/empty_3/expected_log
index a42514f37..e3f236589 100644
--- a/src/test/conf_examples/empty_3/expected_log
+++ b/src/test/conf_examples/empty_3/expected_log
@@ -1 +1 @@
-Included configuration .*directory at recursion level 1.*included
+Processing configuration path \".*included\" at recursion level 1\.
diff --git a/src/test/conf_examples/include_1/expected_log b/src/test/conf_examples/include_1/expected_log
index f95cad040..0791a494d 100644
--- a/src/test/conf_examples/include_1/expected_log
+++ b/src/test/conf_examples/include_1/expected_log
@@ -1 +1 @@
-Included configuration file .*at recursion level 2.*nested\.inc
+Processing configuration path \".*nested\.inc\" at recursion level 2\.
diff --git a/src/test/conf_examples/include_bug_31408/expected_log b/src/test/conf_examples/include_bug_31408/expected_log
index a42514f37..e3f236589 100644
--- a/src/test/conf_examples/include_bug_31408/expected_log
+++ b/src/test/conf_examples/include_bug_31408/expected_log
@@ -1 +1 @@
-Included configuration .*directory at recursion level 1.*included
+Processing configuration path \".*included\" at recursion level 1\.





More information about the tor-commits mailing list