diff --git a/config.c b/config.c index 08508be..143d9db 100644 --- a/config.c +++ b/config.c @@ -94,6 +94,7 @@ struct config_item config_tab[] = { GLOB_ITEM_INT("assume_two_step", 0, 0, 1), GLOB_ITEM_INT("check_fup_sync", 0, 0, 1), GLOB_ITEM_DBL("first_step_threshold", 0.00002, 0.0, DBL_MAX), + GLOB_ITEM_INT("logging_level", LOG_INFO, PRINT_LEVEL_MIN, PRINT_LEVEL_MAX), GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX), GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX), GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX), @@ -623,15 +624,6 @@ static enum parser_result parse_global_setting(const char *option, return OUT_OF_RANGE; strncpy(cfg->uds_address, value, MAX_IFNAME_SIZE); - } else if (!strcmp(option, "logging_level")) { - r = get_ranged_int(value, &val, - PRINT_LEVEL_MIN, PRINT_LEVEL_MAX); - if (r != PARSED_OK) - return r; - if (!(cfg_ignore & CFG_IGNORE_PRINT_LEVEL)) { - cfg->print_level = val; - } - } else if (!strcmp(option, "verbose")) { r = get_ranged_int(value, &val, 0, 1); if (r != PARSED_OK) diff --git a/config.h b/config.h index a297e85..0b7c291 100644 --- a/config.h +++ b/config.h @@ -49,7 +49,6 @@ struct interface { #define CFG_IGNORE_TRANSPORT (1 << 1) #define CFG_IGNORE_TIMESTAMPING (1 << 2) #define CFG_IGNORE_SLAVEONLY (1 << 3) -#define CFG_IGNORE_PRINT_LEVEL (1 << 4) #define CFG_IGNORE_USE_SYSLOG (1 << 5) #define CFG_IGNORE_VERBOSE (1 << 6) @@ -87,7 +86,6 @@ struct config { unsigned char *udp6_scope; char *uds_address; - int print_level; int use_syslog; int verbose; }; diff --git a/ptp4l.c b/ptp4l.c index ca62370..068b1f3 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -118,7 +118,6 @@ static struct config cfg_settings = { .udp6_scope = &udp6_scope, .uds_address = uds_path, - .print_level = LOG_INFO, .use_syslog = 1, .verbose = 0, @@ -169,7 +168,7 @@ int main(int argc, char *argv[]) struct clock *clock; struct config *cfg = &cfg_settings; struct defaultDS *ds = &cfg_settings.dds.dds; - int phc_index = -1, required_modes = 0; + int phc_index = -1, print_level, required_modes = 0; if (handle_term_signals()) return -1; @@ -240,10 +239,10 @@ int main(int argc, char *argv[]) *cfg_ignore |= CFG_IGNORE_SLAVEONLY; break; case 'l': - if (get_arg_val_i(c, optarg, &cfg_settings.print_level, + if (get_arg_val_i(c, optarg, &print_level, PRINT_LEVEL_MIN, PRINT_LEVEL_MAX)) return -1; - *cfg_ignore |= CFG_IGNORE_PRINT_LEVEL; + config_set_int(cfg, "logging_level", print_level); break; case 'm': cfg_settings.verbose = 1; @@ -294,7 +293,7 @@ int main(int argc, char *argv[]) print_set_progname(progname); print_set_verbose(cfg_settings.verbose); print_set_syslog(cfg_settings.use_syslog); - print_set_level(cfg_settings.print_level); + print_set_level(config_get_int(cfg, NULL, "logging_level")); if (STAILQ_EMPTY(&cfg_settings.interfaces)) { fprintf(stderr, "no interface specified\n");