]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
conftest: Add support for time_format and ike_name options in log sections
authorThomas Klute <thomas2.klute@uni-dortmund.de>
Fri, 4 Jan 2013 12:47:15 +0000 (13:47 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 8 Jan 2013 10:12:44 +0000 (11:12 +0100)
Both options are well supported for normal operation but were completely
ignored by conftest, which used hard coded defaults. File options are
still missing but could be added in a similar way.

src/conftest/conftest.c

index e8c257d5e01c207f7a00b142817447b24be41728..c2251effa1073299d3ebd7a77e217970e5dcb868 100644 (file)
@@ -377,6 +377,22 @@ static void load_log_levels(file_logger_t *logger, char *section)
        }
 }
 
+/**
+ * Load logger options for a logger from section
+ */
+static void load_logger_options(file_logger_t *logger, char *section)
+{
+       bool ike_name;
+       char *time_format;
+
+       time_format = conftest->test->get_str(conftest->test,
+                                       "log.%s.time_format", NULL, section);
+       ike_name = conftest->test->get_bool(conftest->test,
+                                       "log.%s.ike_name", FALSE, section);
+
+       logger->set_options(logger, time_format, ike_name);
+}
+
 /**
  * Load logger configuration
  */
@@ -386,6 +402,7 @@ static void load_loggers(file_logger_t *logger)
        char *section;
 
        load_log_levels(logger, "stdout");
+       load_logger_options(logger, "stdout");
        /* Re-add the logger to propagate configuration changes to the
         * logging system */
        charon->bus->add_logger(charon->bus, &logger->logger);
@@ -396,7 +413,7 @@ static void load_loggers(file_logger_t *logger)
                if (!streq(section, "stdout"))
                {
                        logger = file_logger_create(section);
-                       logger->set_options(logger, NULL, FALSE);
+                       load_logger_options(logger, section);
                        logger->open(logger, FALSE, FALSE);
                        load_log_levels(logger, section);
                        charon->bus->add_logger(charon->bus, &logger->logger);