summaryrefslogtreecommitdiffstatsabout
path: root/utility/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility/config.c')
-rw-r--r--utility/config.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/utility/config.c b/utility/config.c
index ccdc6e5..b1e7585 100644
--- a/utility/config.c
+++ b/utility/config.c
@@ -41,12 +41,10 @@ static apr_status_t config_set_loglevel(config_t *cfg, config_opt_t *opt,
41 return APR_EINVAL; 41 return APR_EINVAL;
42 if (!strcasecmp(argv[1], "error")) { 42 if (!strcasecmp(argv[1], "error")) {
43 cfg->loglevel = LOGLEVEL_ERROR; 43 cfg->loglevel = LOGLEVEL_ERROR;
44 } else if (!strcasecmp(argv[1], "warn")) { 44 } else if (!strcasecmp(argv[1], "notice")) {
45 cfg->loglevel = LOGLEVEL_WARN; 45 cfg->loglevel = LOGLEVEL_NOTICE;
46 } else if (!strcasecmp(argv[1], "debug")) { 46 } else if (!strcasecmp(argv[1], "debug")) {
47 cfg->loglevel = LOGLEVEL_DEBUG; 47 cfg->loglevel = LOGLEVEL_DEBUG;
48 } else if (!strcasecmp(argv[1], "quiet")) {
49 cfg->loglevel = LOGLEVEL_QUIET;
50 } else { 48 } else {
51 cfg->loglevel = LOGLEVEL_ERROR; 49 cfg->loglevel = LOGLEVEL_ERROR;
52 } 50 }
@@ -293,6 +291,8 @@ void config_init(apr_pool_t *p)
293 291
294 config_add_option(p, "DryRun", "Don't perform any actual database changes", 292 config_add_option(p, "DryRun", "Don't perform any actual database changes",
295 config_set_flag, (void *)APR_OFFSETOF(config_t, dryrun)); 293 config_set_flag, (void *)APR_OFFSETOF(config_t, dryrun));
294 config_add_option(p, "Dump", "Dump Configuration and quit",
295 config_set_flag, (void *)APR_OFFSETOF(config_t, dump));
296 config_add_option(p, "Config", "Dummy to handle config directive", 296 config_add_option(p, "Config", "Dummy to handle config directive",
297 config_set_dummy, NULL); 297 config_set_dummy, NULL);
298 config_add_option(p, "Summary", "Show the summary before exit?", 298 config_add_option(p, "Summary", "Show the summary before exit?",
@@ -306,7 +306,7 @@ config_t *config_create(apr_pool_t *p)
306 apr_pool_create(&sp, p); 306 apr_pool_create(&sp, p);
307 cfg = apr_pcalloc(sp, sizeof(config_t)); 307 cfg = apr_pcalloc(sp, sizeof(config_t));
308 cfg->pool = sp; 308 cfg->pool = sp;
309 cfg->loglevel = LOGLEVEL_WARN; 309 cfg->loglevel = LOGLEVEL_ERROR;
310 cfg->summary = 1; 310 cfg->summary = 1;
311 cfg->transactions = 1; 311 cfg->transactions = 1;
312 cfg->input_files = apr_array_make(cfg->pool, 10, sizeof(char *)); 312 cfg->input_files = apr_array_make(cfg->pool, 10, sizeof(char *));
@@ -320,15 +320,15 @@ apr_status_t config_check(config_t *cfg)
320{ 320{
321 apr_status_t ret = APR_SUCCESS; 321 apr_status_t ret = APR_SUCCESS;
322 if (!cfg->dbdriver || !cfg->dbparams) { 322 if (!cfg->dbdriver || !cfg->dbparams) {
323 printf("Database configuration is missing\n"); 323 logging_log(cfg, LOGLEVEL_NOISE, "Database configuration is missing\n");
324 ret = APR_EINVAL; 324 ret = APR_EINVAL;
325 } 325 }
326 if (!cfg->table) { 326 if (!cfg->table) {
327 printf("No Log Table defined\n"); 327 logging_log(cfg, LOGLEVEL_NOISE, "No Log Table defined\n");
328 ret = APR_EINVAL; 328 ret = APR_EINVAL;
329 } 329 }
330 if (apr_is_empty_array(cfg->output_fields)) { 330 if (apr_is_empty_array(cfg->output_fields)) {
331 printf("No Output Fields Defined\n"); 331 logging_log(cfg, LOGLEVEL_NOISE, "No Output Fields Defined\n");
332 ret = APR_EINVAL; 332 ret = APR_EINVAL;
333 } 333 }
334 return ret; 334 return ret;
@@ -345,7 +345,7 @@ static int config_merge(void *rec, const char *key, const char *value)
345 value }; 345 value };
346 opt->func(cfg, opt, 2, args); 346 opt->func(cfg, opt, 2, args);
347 } else { 347 } else {
348 printf("Unhandled: %s\n", key); 348 logging_log(cfg, LOGLEVEL_NOISE, "Unhandled: %s\n", key);
349 } 349 }
350 return 1; 350 return 1;
351} 351}
@@ -400,12 +400,13 @@ apr_status_t config_read(config_t *cfg, const char *filename,
400 if (opt) { 400 if (opt) {
401 rv = opt->func(cfg, opt, targc, (const char **)targv); 401 rv = opt->func(cfg, opt, targc, (const char **)targv);
402 if (APR_STATUS_IS_EINVAL(rv)) { 402 if (APR_STATUS_IS_EINVAL(rv)) {
403 printf("Config Error: Invalid Arguments for %s\n\t%s\n", 403 logging_log(cfg, LOGLEVEL_NOISE,
404 "Config Error: Invalid Arguments for %s\n\t%s\n",
404 opt->name, opt->help); 405 opt->name, opt->help);
405 ret = rv; 406 ret = rv;
406 } 407 }
407 } else { 408 } else {
408 printf("Unhandled: %s\n", targv[0]); 409 logging_log(cfg, LOGLEVEL_NOISE, "Unhandled: %s\n", targv[0]);
409 } 410 }
410 } 411 }
411 } while (rv == APR_SUCCESS); 412 } while (rv == APR_SUCCESS);