Skip to content

Commit

Permalink
[logging] support disable syslog for otbr-web as well (#2442)
Browse files Browse the repository at this point in the history
Commit c88a5fc ("[logging] add command line arg to disable syslog")
allows to disable logging to syslog via command line argument. Support
the same -s command line argument for otbr-web as well.
  • Loading branch information
agners authored Sep 25, 2024
1 parent cb6b43b commit bc90c71
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/web/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ int main(int argc, char **argv)
otbrLogLevel logLevel = OTBR_LOG_INFO;
int ret = 0;
int opt;
uint16_t port = OT_HTTP_PORT;
uint16_t port = OT_HTTP_PORT;
bool syslogDisable = false;

while ((opt = getopt(argc, argv, "d:I:p:va:")) != -1)
while ((opt = getopt(argc, argv, "d:I:p:va:s")) != -1)
{
switch (opt)
{
Expand All @@ -103,6 +104,10 @@ int main(int argc, char **argv)
ExitNow();
break;

case 's':
syslogDisable = true;
break;

default:
fprintf(stderr, "Usage: %s [-d DEBUG_LEVEL] [-I interfaceName] [-p port] [-a listenAddress] [-v]\n",
argv[0]);
Expand All @@ -111,7 +116,7 @@ int main(int argc, char **argv)
}
}

otbrLogInit(argv[0], logLevel, true, false);
otbrLogInit(argv[0], logLevel, true, syslogDisable);
otbrLogInfo("Running %s", OTBR_PACKAGE_VERSION);

if (interfaceName == nullptr)
Expand Down

0 comments on commit bc90c71

Please sign in to comment.