mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
main: add runtime flag for setting the logger
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".
This commit is contained in:
parent
c54ef5a8da
commit
32f3745745
14
src/main.c
14
src/main.c
@ -63,6 +63,7 @@ static const char *nointerfaces;
|
|||||||
static const char *phys;
|
static const char *phys;
|
||||||
static const char *nophys;
|
static const char *nophys;
|
||||||
static const char *debugopt;
|
static const char *debugopt;
|
||||||
|
static const char *logger;
|
||||||
static bool developeropt;
|
static bool developeropt;
|
||||||
static bool terminating;
|
static bool terminating;
|
||||||
static bool nl80211_complete;
|
static bool nl80211_complete;
|
||||||
@ -164,6 +165,7 @@ static const struct option main_options[] = {
|
|||||||
{ "nointerfaces", required_argument, NULL, 'I' },
|
{ "nointerfaces", required_argument, NULL, 'I' },
|
||||||
{ "phys", required_argument, NULL, 'p' },
|
{ "phys", required_argument, NULL, 'p' },
|
||||||
{ "nophys", required_argument, NULL, 'P' },
|
{ "nophys", required_argument, NULL, 'P' },
|
||||||
|
{ "logger", required_argument, NULL, 'l' },
|
||||||
{ "debug", optional_argument, NULL, 'd' },
|
{ "debug", optional_argument, NULL, 'd' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ }
|
{ }
|
||||||
@ -474,7 +476,7 @@ int main(int argc, char *argv[])
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
int opt;
|
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);
|
main_options, NULL);
|
||||||
if (opt < 0)
|
if (opt < 0)
|
||||||
break;
|
break;
|
||||||
@ -503,6 +505,9 @@ int main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
debugopt = "*";
|
debugopt = "*";
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
logger = optarg;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("%s\n", VERSION);
|
printf("%s\n", VERSION);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@ -519,7 +524,12 @@ int main(int argc, char *argv[])
|
|||||||
return EXIT_FAILURE;
|
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)
|
if (check_crypto() < 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user