summaryrefslogtreecommitdiffhomepage
path: root/src/odhcpd.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2017-02-14 11:59:14 +0100
committerHans Dedecker <dedeckeh@gmail.com>2017-02-14 13:38:26 +0100
commita898ee5458950203d4b2f8fec28c85313c855b91 (patch)
treef1b37449b5fd354e31a16c466957472cf4aa5fb1 /src/odhcpd.c
parent51c756cfc15c63322df9fdb70d5c701cfb6b9a9f (diff)
config: make loglevel configurable via uci (FS#481)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/odhcpd.c')
-rw-r--r--src/odhcpd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/odhcpd.c b/src/odhcpd.c
index 9a76e4d..8a18fbf 100644
--- a/src/odhcpd.c
+++ b/src/odhcpd.c
@@ -24,6 +24,7 @@
#include <unistd.h>
#include <signal.h>
#include <stdbool.h>
+#include <syslog.h>
#include <arpa/inet.h>
#include <net/if.h>
@@ -52,7 +53,6 @@
static int ioctl_sock;
static struct nl_sock *rtnl_socket = NULL;
static int urandom_fd = -1;
-static int log_level = LOG_INFO;
static void sighandler(_unused int signal)
{
@@ -65,7 +65,7 @@ static void print_usage(const char *app)
"== %s Usage ==\n\n"
" -h, --help Print this help\n"
" -l level Specify log level 0..7 (default %d)\n",
- app, log_level
+ app, config.log_level
);
}
@@ -80,12 +80,12 @@ int main(int argc, char **argv)
print_usage(argv[0]);
return 0;
case 'l':
- log_level = atoi(optarg);
- fprintf(stderr, "Log level set to %d\n", log_level);
+ config.log_level = (atoi(optarg) & LOG_PRIMASK);
+ fprintf(stderr, "Log level set to %d\n", config.log_level);
break;
}
}
- setlogmask(LOG_UPTO(log_level));
+ setlogmask(LOG_UPTO(config.log_level));
uloop_init();
if (getuid() != 0) {