log: add syslog support

Add support to log using standard syslog,
add related option in dhtnode.
dhtnode will use syslog by default
when starting in daemon mode and
no logfile is defined.
This commit is contained in:
Adrien Beraud committed 2017-05-30 12:20:09 +02:00
1 parent 3aa720fe1f
commit 39a254ce9f
4 files changed
+48 -6

No files matched your search

+3 -1
View File
@@ -370,7 +370,9 @@ main(int argc, char **argv)
dht->run(params.port, crt, true, params.network);
if (params.log) {
if (not params.logfile.empty())
if (params.syslog or (params.daemonize and params.logfile.empty()))
log::enableSyslog(*dht, "dhtnode");
else if (not params.logfile.empty())
log::enableFileLogging(*dht, params.logfile);
else
log::enableLogging(*dht);