aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-17 11:57:52 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-17 11:57:52 +0100
commit48a9df043df64887cb99e03d7613379c947d11d8 (patch)
tree897d94bcc55c481a82878c5d2de5ec3369df33ed /src/common.h
parenta54421dd976fd8081e96c11c2621076876c9986b (diff)
downloadBobinkCOpcUa-48a9df043df64887cb99e03d7613379c947d11d8.tar.gz
BobinkCOpcUa-48a9df043df64887cb99e03d7613379c947d11d8.zip
Add configurable log level as optional CLI argument
All three programs now accept an optional second argument [log-level] (trace, debug, info, warning, error, fatal) defaulting to info. The level is applied by setting the logger context pointer directly, avoiding a memory leak that would occur from overwriting the heap-allocated logger struct. Also documents the ASan leak-check workflow in CLAUDE.md.
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index e3d2f4c..e8c0c78 100644
--- a/src/common.h
+++ b/src/common.h
@@ -44,6 +44,17 @@ UA_Server *createSecureServer (UA_UInt16 port, const char *applicationUri,
UA_StatusCode *retval);
/**
+ * @brief Parses a log-level name into the corresponding UA_LogLevel value.
+ *
+ * Accepted names (case-sensitive): "trace", "debug", "info", "warning",
+ * "error", "fatal".
+ *
+ * @param name Log-level name string.
+ * @return The matching UA_LogLevel, or -1 if the name is not recognized.
+ */
+int parseLogLevel (const char *name);
+
+/**
* @brief Parses a security mode name into the corresponding enum value.
*
* Accepted names: "None", "Sign", "SignAndEncrypt".