diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-06-30 22:04:29 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-06-30 22:04:29 +0200 |
commit | 4035f4900d7db34785433b53c4ec1da046b55868 (patch) | |
tree | 3b86e9847a8a7b27d8b7aa9d7da0c551752133d7 /main.c | |
parent | 4ca38c90cfe529e9fdd6f843680820074a869149 (diff) |
init/close syslog logging
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -10,6 +10,7 @@ #include <signal.h> #include <stdio.h> #include <stdlib.h> +#include <syslog.h> #include <unistd.h> #if (NDPI_MAJOR == 3 && NDPI_MINOR < 3) || NDPI_MAJOR < 3 @@ -111,6 +112,7 @@ static struct nDPId_reader_thread reader_threads[MAX_READER_THREADS] = {}; static int reader_thread_count = MAX_READER_THREADS; static int main_thread_shutdown = 0; static uint32_t flow_id = 0; +static int log_to_stderr = 0; static void free_workflow(struct nDPId_workflow ** const workflow); @@ -1201,9 +1203,13 @@ int main(int argc, char ** argv) "----------------------------------\n" "nDPI version: %s\n" " API version: %u\n" + "pcap version: %s\n" "----------------------------------\n", argv[0], - ndpi_revision(), ndpi_get_api_version()); + ndpi_revision(), ndpi_get_api_version(), + pcap_lib_version() + strlen("libpcap version ")); + + openlog("nDPId", LOG_CONS | (log_to_stderr != 0 ? LOG_PERROR : 0), LOG_DAEMON); if (setup_reader_threads((argc >= 2 ? argv[1] : NULL)) != 0) { fprintf(stderr, "%s: setup_reader_threads failed\n", argv[0]); @@ -1226,5 +1232,7 @@ int main(int argc, char ** argv) return 1; } + closelog(); + return 0; } |