mirror of
https://github.com/alexhopeoconnor/DFTE.git
synced 2026-10-19 01:01:32 +10:00
Extend DFTE template engine debug API and refine renderer logging.
Add helpers in DeviceFrameworkTemplateEngineDebug and wire clearer instrumentation in DeviceFrameworkTemplateRenderer; update README.
This commit is contained in:
@@ -41,6 +41,9 @@ public:
|
||||
// Global logger pointer - set by user or defaults to nullptr (disabled)
|
||||
extern DeviceFrameworkTemplateEngineLogger* deviceFrameworkTemplateEngineLogger;
|
||||
|
||||
/** Opaque owner tag for the active logger (set on enable). Used to disable without clobbering another host. */
|
||||
extern const void* deviceFrameworkTemplateEngineLoggerOwner;
|
||||
|
||||
// ============================================================================
|
||||
// LOGGING MACROS - NO-OPS BY DEFAULT
|
||||
// ============================================================================
|
||||
@@ -86,6 +89,13 @@ extern DeviceFrameworkTemplateEngineLogger* deviceFrameworkTemplateEngineLogger;
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/** Optional verbose trace (compile with -DDFTE_ENABLE_TRACE). Maps to debug() on the active logger. */
|
||||
#if defined(DFTE_ENABLE_TRACE)
|
||||
#define DFTE_LOG_TRACE(msg) DFTE_LOG_DEBUG(String(F("[TRACE] ")) + String(msg))
|
||||
#else
|
||||
#define DFTE_LOG_TRACE(msg) do { (void)0; } while(0)
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// LOGGING CONFIGURATION FUNCTIONS
|
||||
// ============================================================================
|
||||
@@ -98,12 +108,21 @@ extern DeviceFrameworkTemplateEngineLogger* deviceFrameworkTemplateEngineLogger;
|
||||
*/
|
||||
bool deviceFrameworkTemplateEngineEnableLogging(DeviceFrameworkTemplateEngineLogger* logger);
|
||||
|
||||
/**
|
||||
* Enable logging and record an owner tag (e.g. `this` of WiFiManagerServer).
|
||||
* If ownerTag is nullptr, the logger pointer is used as the tag.
|
||||
*/
|
||||
bool deviceFrameworkTemplateEngineEnableLogging(DeviceFrameworkTemplateEngineLogger* logger, const void* ownerTag);
|
||||
|
||||
/**
|
||||
* Disable all logging
|
||||
* Sets logger to nullptr, making all DFTE_LOG_* macros no-ops
|
||||
*/
|
||||
void deviceFrameworkTemplateEngineDisableLogging();
|
||||
|
||||
/** Disable only if the current logger was registered with this owner tag. Returns true if disabled. */
|
||||
bool deviceFrameworkTemplateEngineDisableLoggingForOwner(const void* ownerTag);
|
||||
|
||||
/**
|
||||
* Check if logging is currently enabled
|
||||
*
|
||||
@@ -118,4 +137,6 @@ bool deviceFrameworkTemplateEngineIsLoggingEnabled();
|
||||
*/
|
||||
DeviceFrameworkTemplateEngineLogger* deviceFrameworkTemplateEngineGetLogger();
|
||||
|
||||
const void* deviceFrameworkTemplateEngineGetLoggerOwner();
|
||||
|
||||
#endif // DEVICEFRAMEWORK_TEMPLATE_ENGINE_DEBUG_H
|
||||
Reference in New Issue
Block a user