diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-01 22:47:55 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-01 22:47:55 +0200 |
commit | e0a3556742a81e6cb6e72590b2696ea39e9872ea (patch) | |
tree | d5d16e2f914aa30390558924985339ffe8ec83b7 /src/config.c | |
parent | 350353d2c1282b2802bba83f49a3508b3beeb24a (diff) | |
download | fastd-e0a3556742a81e6cb6e72590b2696ea39e9872ea.tar fastd-e0a3556742a81e6cb6e72590b2696ea39e9872ea.zip |
Add log level configuration
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c index 8534fe2..358a785 100644 --- a/src/config.c +++ b/src/config.c @@ -49,7 +49,7 @@ extern fastd_protocol fastd_protocol_ec25519_fhmqvc_xsalsa20_poly1305; static void default_config(fastd_config *conf) { - conf->loglevel = LOG_DEBUG; + conf->loglevel = LOG_INFO; conf->peer_stale_time = 300; conf->peer_stale_time_temp = 30; @@ -223,6 +223,24 @@ void fastd_configure(fastd_context *ctx, fastd_config *conf, int argc, char *con while (i < argc) { + IF_OPTION_ARG("--log-level") { + if (!strcmp(arg, "fatal")) + conf->loglevel = LOG_FATAL; + else if (!strcmp(arg, "error")) + conf->loglevel = LOG_ERROR; + else if (!strcmp(arg, "warn")) + conf->loglevel = LOG_WARN; + else if (!strcmp(arg, "info")) + conf->loglevel = LOG_INFO; + else if (!strcmp(arg, "verbose")) + conf->loglevel = LOG_VERBOSE; + else if (!strcmp(arg, "debug")) + conf->loglevel = LOG_DEBUG; + else + exit_error(ctx, "invalid mode `%s'", arg); + continue; + } + IF_OPTION_ARG("-c", "--config") { fastd_read_config(ctx, conf, arg, false, 0); continue; |