From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 3/7] main: add runtime flag for setting the logger
Date: Thu, 22 Feb 2024 07:24:47 -0800 [thread overview]
Message-ID: <20240222152451.1541682-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20240222152451.1541682-1-prestwoj@gmail.com>
The --logger,-l flag can now be used to specify the logger type.
Unset (default) will set log output to stderr as it is today. The
other valid options are "syslog" and "journal".
---
src/main.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
index 3ce8340f..acbfdc0c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -63,6 +63,7 @@ static const char *nointerfaces;
static const char *phys;
static const char *nophys;
static const char *debugopt;
+static const char *logger;
static bool developeropt;
static bool terminating;
static bool nl80211_complete;
@@ -164,6 +165,7 @@ static const struct option main_options[] = {
{ "nointerfaces", required_argument, NULL, 'I' },
{ "phys", required_argument, NULL, 'p' },
{ "nophys", required_argument, NULL, 'P' },
+ { "logger", required_argument, NULL, 'l' },
{ "debug", optional_argument, NULL, 'd' },
{ "help", no_argument, NULL, 'h' },
{ }
@@ -474,7 +476,7 @@ int main(int argc, char *argv[])
for (;;) {
int opt;
- opt = getopt_long(argc, argv, "Ei:I:p:P:d::vh",
+ opt = getopt_long(argc, argv, "Ei:I:p:P:d::vhl:",
main_options, NULL);
if (opt < 0)
break;
@@ -503,6 +505,9 @@ int main(int argc, char *argv[])
else
debugopt = "*";
break;
+ case 'l':
+ logger = optarg;
+ break;
case 'v':
printf("%s\n", VERSION);
return EXIT_SUCCESS;
@@ -519,7 +524,12 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
- l_log_set_stderr();
+ if (logger && !strcmp(logger, "syslog"))
+ l_log_set_syslog();
+ else if (logger && !strcmp(logger, "journal"))
+ l_log_set_journal();
+ else
+ l_log_set_stderr();
if (check_crypto() < 0)
return EXIT_FAILURE;
--
2.34.1
next prev parent reply other threads:[~2024-02-22 15:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 15:24 [PATCH 1/7] auto-t: fix failed_roam_test to pass when run on its own James Prestwood
2024-02-22 15:24 ` [PATCH 2/7] auto-t: timestamp log files in test-runner James Prestwood
2024-02-22 15:24 ` James Prestwood [this message]
2024-02-22 16:16 ` [PATCH 3/7] main: add runtime flag for setting the logger Denis Kenzior
2024-02-22 15:24 ` [PATCH 4/7] iwd: add iwd_notice for special event/state type of logging James Prestwood
2024-02-22 15:24 ` [PATCH 5/7] doc: document use of l_log APIs James Prestwood
2024-02-22 15:24 ` [PATCH 6/7] station: use iwd_notice for state/event information James Prestwood
2024-02-22 15:24 ` [PATCH 7/7] netdev: add notice events for connection timeouts James Prestwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240222152451.1541682-3-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox