aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c
index d102868..7d378f1 100644
--- a/src/common.c
+++ b/src/common.c
@@ -59,6 +59,26 @@ loadFile (const char *const path)
* Security Helpers
* ======================================================================== */
+int
+parseLogLevel (const char *name)
+{
+ static const struct
+ {
+ const char *name;
+ UA_LogLevel level;
+ } levels[] = {
+ { "trace", UA_LOGLEVEL_TRACE }, { "debug", UA_LOGLEVEL_DEBUG },
+ { "info", UA_LOGLEVEL_INFO }, { "warning", UA_LOGLEVEL_WARNING },
+ { "error", UA_LOGLEVEL_ERROR }, { "fatal", UA_LOGLEVEL_FATAL },
+ };
+ for (size_t i = 0; i < sizeof (levels) / sizeof (levels[0]); i++)
+ {
+ if (strcmp (name, levels[i].name) == 0)
+ return (int)levels[i].level;
+ }
+ return -1;
+}
+
UA_MessageSecurityMode
parseSecurityMode (const char *name)
{