aboutsummaryrefslogtreecommitdiffstats
path: root/src/client_find_servers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/client_find_servers.c')
-rw-r--r--src/client_find_servers.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/client_find_servers.c b/src/client_find_servers.c
index e50623f..a85b63f 100644
--- a/src/client_find_servers.c
+++ b/src/client_find_servers.c
@@ -211,10 +211,21 @@ readServerTime (UA_Client *client,
int
main (int argc, char **argv)
{
- if (argc != 2)
+ if (argc < 2 || argc > 3)
{
UA_LOG_FATAL (UA_Log_Stdout, UA_LOGCATEGORY_USERLAND,
- "Usage: %s <config-file>", argv[0]);
+ "Usage: %s <config-file> [log-level]", argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ const char *logLevelStr = (argc == 3) ? argv[2] : "info";
+ int logLevel = parseLogLevel (logLevelStr);
+ if (logLevel < 0)
+ {
+ UA_LOG_FATAL (UA_Log_Stdout, UA_LOGCATEGORY_USERLAND,
+ "Unknown log level: %s "
+ "(expected trace, debug, info, warning, error, fatal)",
+ logLevelStr);
return EXIT_FAILURE;
}
@@ -302,6 +313,8 @@ main (int argc, char **argv)
configFree (&cfg);
return EXIT_FAILURE;
}
+ UA_ClientConfig *clientConfig = UA_Client_getConfig (client);
+ clientConfig->logging->context = (void *)(uintptr_t)logLevel;
UA_ApplicationDescription *applicationDescriptionArray = NULL;
size_t applicationDescriptionArraySize = 0;