Enable log information

This commit is contained in:
2026-04-21 12:09:24 +10:00
parent 7e772f76bc
commit 00f6e2f852
5 changed files with 247 additions and 40 deletions

View File

@@ -73,28 +73,27 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
endif()
endif()
# ── DebugView logging toggle ────────────────────────────────────
# When ON, every ANS_DBG(...) call across the whole tree expands to an
# OutputDebugStringA() call visible in Sysinternals DebugView (Dbgview.exe).
# This is the single switch for verbose runtime diagnostics in ANSLPR,
# ANSCV (RTSP lifecycle, HW decoder auto-config), ANSODEngine (NV12 fast
# path, ORT/TRT engine selection), ANSFR (face recognizer state), etc.
# ── DebugView logging toggle (runtime-gated) ────────────────────
# ANS_DBG is compiled into every build by default and gated at runtime by
# ANSCENTER_IsDebugViewEnabled() (see ANSLicense.h/.cpp). Users toggle
# logging without a rebuild by creating or deleting
# C:\ProgramData\ANSCENTER\ansvisdebugview.txt (Windows), or
# /tmp/ansvisdebugview.txt (POSIX),
# or by setting env var ANSCENTER_DBGVIEW=1/0. Effect propagates within ~2 s.
#
# Enable it to diagnose field issues (e.g. "ALPR worked for a while then
# stopped"), then turn it back OFF for production because every ANS_DBG
# call adds a kernel round-trip and string formatting cost.
# This CMake option is a HARD KILL-SWITCH only — set it ON to strip ANS_DBG
# to ((void)0) at compile time. Use it only when even the cached atomic-load
# cost is unacceptable (tight inner loops). Default OFF = runtime-gated.
#
# Usage:
# cmake -B build -DANSCORE_DEBUGVIEW=ON # enable
# cmake -B build -DANSCORE_DEBUGVIEW=OFF # disable (default)
#
# Or toggle in CLion/VS: edit the cache variable ANSCORE_DEBUGVIEW.
option(ANSCORE_DEBUGVIEW "Enable ANS_DBG OutputDebugString logging for DebugView" OFF)
if(ANSCORE_DEBUGVIEW)
add_compile_definitions(ANSCORE_DEBUGVIEW=1)
message(STATUS "ANSCORE_DEBUGVIEW = ON — ANS_DBG verbose logging ENABLED (DebugView)")
# cmake -B build # default: runtime-gated
# cmake -B build -DANSCORE_DEBUGVIEW_STRIP=ON # hard-strip all ANS_DBG
option(ANSCORE_DEBUGVIEW_STRIP "Hard-strip ANS_DBG calls at compile time (removes runtime toggle)" OFF)
if(ANSCORE_DEBUGVIEW_STRIP)
add_compile_definitions(ANSCORE_DEBUGVIEW=0)
message(STATUS "ANSCORE_DEBUGVIEW_STRIP = ON — ANS_DBG compiled OUT (no runtime toggle)")
else()
message(STATUS "ANSCORE_DEBUGVIEW = OFF — ANS_DBG verbose logging disabled (production)")
message(STATUS "ANSCORE_DEBUGVIEW_STRIP = OFF — ANS_DBG compiled IN, gated at runtime (sentinel file / env var)")
endif()
# ── Vendored libyuv (submodule: 3rdparty/libyuv) ────────────────