Support Get log events
This commit is contained in:
@@ -155,6 +155,20 @@ namespace ANSCENTER {
|
||||
// Reverses DoubleEscapeUnicode so other languages can parse \uXXXX correctly.
|
||||
static std::string UnescapeDoubleEscapedUnicode(const std::string& str);
|
||||
|
||||
// Read every Error-level event from "ANSLogger" in the Windows
|
||||
// Application event log. Output: one line per event in the form
|
||||
// "<DD/MM/YYYY h:mm:ss tt>: <event data string>\n"
|
||||
// Time is converted to the user's local timezone and formatted
|
||||
// using LOCALE_USER_DEFAULT (matches Event Viewer's display).
|
||||
//
|
||||
// If `clearAfterRead` is true, calls EvtClearLog on the entire
|
||||
// Application channel after reading. WARNING: this wipes every
|
||||
// event from every source in the Application log, not just
|
||||
// ANSLogger entries — there is no per-event delete API in
|
||||
// Windows. Requires Administrator privileges; without elevation
|
||||
// the clear silently fails (events are still returned).
|
||||
[[nodiscard]] static std::string GetANSLoggerErrorEvents(bool clearAfterRead = false);
|
||||
|
||||
// Scan the local network for AIBOX / ANSVIS servers.
|
||||
// Runs two strategies in parallel and merges results by IP:
|
||||
// 1) UDP multicast probe to 230.50.200.150:58839 (with subnet
|
||||
@@ -376,6 +390,14 @@ extern "C" ANSULT_API int RebootSystem();
|
||||
extern "C" ANSULT_API int ScanANSDevices(int timeoutMs, LStrHandle resultJson);
|
||||
extern "C" ANSULT_API int ScanANSDevicesCpp(int timeoutMs, std::string& resultJson);
|
||||
|
||||
// Read all Error-level events from "ANSLogger" in the Windows Application
|
||||
// event log. Returns a UTF-8 string with one event per line:
|
||||
// "<DD/MM/YYYY h:mm:ss tt>: <event data>\n"
|
||||
// `clearAfterRead` != 0 clears the entire Application channel afterwards
|
||||
// (requires Administrator; see header comment on the C++ method).
|
||||
extern "C" ANSULT_API int GetANSLoggerErrorEvents(int clearAfterRead, LStrHandle result);
|
||||
extern "C" ANSULT_API int GetANSLoggerErrorEventsCpp(int clearAfterRead, std::string& result);
|
||||
|
||||
// Unicode conversion utilities for LabVIEW
|
||||
extern "C" ANSULT_API int ANSConvertUTF8ToUTF16LE(const char* utf8Str, LStrHandle result, int includeBOM = 1);
|
||||
extern "C" ANSULT_API int ANSDecodeJsonUnicodeToUTF16LE(const char* escapedStr, LStrHandle result);
|
||||
|
||||
Reference in New Issue
Block a user