Add debug and log functions to ANSLIB
This commit is contained in:
@@ -327,7 +327,36 @@ namespace ANSCENTER
|
||||
std::cerr << "SPDLogger::LogFatal - Exception: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// C facade — exported with stable C linkage so ANSLIB (and any other consumer)
|
||||
// can resolve via GetProcAddress without coupling to the C++ class ABI.
|
||||
// Each call delegates to the process-wide SPDLogger singleton; the magic-static
|
||||
// inside GetInstance handles thread-safe one-time initialisation.
|
||||
extern "C" {
|
||||
ANSLICENSE_API void ANSLogger_LogInfo(const char* src, const char* msg, const char* file, int line) {
|
||||
try {
|
||||
ANSCENTER::SPDLogger::GetInstance("ANSLIB").LogInfo(
|
||||
src ? src : "", msg ? msg : "", file ? file : "", line);
|
||||
} catch (...) {}
|
||||
}
|
||||
ANSLICENSE_API void ANSLogger_LogError(const char* src, const char* msg, const char* file, int line) {
|
||||
try {
|
||||
ANSCENTER::SPDLogger::GetInstance("ANSLIB").LogError(
|
||||
src ? src : "", msg ? msg : "", file ? file : "", line);
|
||||
} catch (...) {}
|
||||
}
|
||||
ANSLICENSE_API void ANSLogger_LogFatal(const char* src, const char* msg, const char* file, int line) {
|
||||
try {
|
||||
ANSCENTER::SPDLogger::GetInstance("ANSLIB").LogFatal(
|
||||
src ? src : "", msg ? msg : "", file ? file : "", line);
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
|
||||
namespace ANSCENTER
|
||||
{
|
||||
|
||||
EngineType ANSCENTER::ANSLicenseHelper::CheckHardwareInformation()
|
||||
{
|
||||
ANS_DBG("HWInfo", "CheckHardwareInformation: starting hardware detection");
|
||||
|
||||
@@ -32,6 +32,15 @@
|
||||
// filesystem check runs at most once per ~2 s.
|
||||
extern "C" ANSLICENSE_API int ANSCENTER_IsDebugViewEnabled(void);
|
||||
|
||||
// C-linkage facade over SPDLogger so consumers can dynamic-load these via
|
||||
// GetProcAddress without depending on the C++ class ABI. Each call routes to
|
||||
// the process-wide SPDLogger singleton (thread-safe magic-static init).
|
||||
extern "C" {
|
||||
ANSLICENSE_API void ANSLogger_LogInfo (const char* src, const char* msg, const char* file, int line);
|
||||
ANSLICENSE_API void ANSLogger_LogError(const char* src, const char* msg, const char* file, int line);
|
||||
ANSLICENSE_API void ANSLogger_LogFatal(const char* src, const char* msg, const char* file, int line);
|
||||
}
|
||||
|
||||
// ANS_DBG: Debug logging macro for DebugView (OutputDebugStringA on Windows).
|
||||
// Usage: ANS_DBG("MyModule", "value=%d ptr=%p", val, ptr);
|
||||
// Output: [MyModule] value=42 ptr=0x1234
|
||||
|
||||
Reference in New Issue
Block a user