From: Michael Tremer Date: Sun, 29 Jan 2023 21:57:32 +0000 (+0000) Subject: networkd: Add some very simple logging X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c251a9ddf0771b85af69f226e886bdd511e2353d;p=network.git networkd: Add some very simple logging Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 40d900e2..abba6465 100644 --- a/Makefile.am +++ b/Makefile.am @@ -306,6 +306,7 @@ sbin_PROGRAMS += \ dist_networkd_SOURCES = \ src/networkd/daemon.c \ src/networkd/daemon.h \ + src/networkd/logging.h \ src/networkd/main.c networkd_CPPFLAGS = \ diff --git a/src/networkd/daemon.c b/src/networkd/daemon.c index c6acefe2..4d21bb66 100644 --- a/src/networkd/daemon.c +++ b/src/networkd/daemon.c @@ -23,6 +23,7 @@ #include #include "daemon.h" +#include "logging.h" struct nw_daemon { int nrefs; @@ -37,14 +38,14 @@ static int nw_daemon_setup_loop(struct nw_daemon* daemon) { // Fetch a reference to the default event loop r = sd_event_default(&daemon->loop); if (r < 0) { - //ERROR("Could not setup event loop: %m\n"); + ERROR("Could not setup event loop: %m\n"); return 1; } // Enable the watchdog r = sd_event_set_watchdog(daemon->loop, 1); if (r < 0) { - //ERROR("Could not activate watchdog: %m\n"); + ERROR("Could not activate watchdog: %m\n"); return 1; } @@ -118,7 +119,7 @@ int nw_daemon_run(struct nw_daemon* daemon) { // Launch the event loop r = sd_event_loop(daemon->loop); if (r) { - //ERROR("Could not run the event loop: %m\n"); + ERROR("Could not run the event loop: %m\n"); return r; } diff --git a/src/networkd/logging.h b/src/networkd/logging.h new file mode 100644 index 00000000..9d51f212 --- /dev/null +++ b/src/networkd/logging.h @@ -0,0 +1,32 @@ +/*############################################################################# +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2023 IPFire Network Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#ifndef NETWORKD_LOGGING_H +#define NETWORKD_LOGGING_H + +#include + +/* + This is just something simple which will work for now... +*/ +#define ERROR(...) fprintf(stderr, __VA_ARGS__) +#define DEBUG(...) printf(__VA_ARGS__) + +#endif /* NETWORKD_LOGGING_H */