aboutsummaryrefslogtreecommitdiffstats
path: root/CLAUDE.md
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 /CLAUDE.md
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 'CLAUDE.md')
-rw-r--r--CLAUDE.md19
1 files changed, 18 insertions, 1 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 4135924..cabc688 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -61,7 +61,7 @@ Existing certs live in `certs/`. Only regenerate if missing.
## Running
-Each program takes a single argument: a configuration file. Example config files are in `config/`. Start programs in order in separate terminals from the project root:
+Each program takes a configuration file and an optional log level: `<program> <config-file> [log-level]`. The log level defaults to `info`. Valid levels: `trace`, `debug`, `info`, `warning`, `error`, `fatal`. Example config files are in `config/`. Start programs in order in separate terminals from the project root:
**1. Local Discovery Server (LDS)**
@@ -163,6 +163,23 @@ Each test starts ServerLDS (port 14840) and ServerRegister (port 14841), runs Cl
To add a new test case: create a directory under `tests/` with 3 config files (`server_lds.conf`, `server_register.conf`, `client_find_servers.conf`), then add a `"name;ExpectedPolicy"` entry to the `INTEGRATION_TESTS` list in `CMakeLists.txt`.
+### Memory Leak Check (ASan)
+
+Rebuild with AddressSanitizer, then run the tests:
+
+```sh
+cmake -B build -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address"
+cmake --build build --parallel
+ASAN_OPTIONS="detect_leaks=1" ctest --test-dir build --output-on-failure
+```
+
+Reconfigure without the flags afterwards to return to a normal build:
+
+```sh
+cmake -B build -DCMAKE_C_FLAGS="" -DCMAKE_EXE_LINKER_FLAGS=""
+cmake --build build --parallel
+```
+
## Project Structure
| Path | Purpose |