Capturing Events With Custom Data Structures (Windows CE 5.0)
You can log any type of data, including any data structure, to CeLog.
To log any data structure with CeLog
Create a unique event identifier between CELID_USER and CELID_MAX.
The following definition creates an event identifier called CELID_MY_EVENT:
#define CELID_MY_EVENT (CELID_USER+0)
By creating a different ID for each different data type you use, you can easily distinguish between data types when you view them in Readlog or Remote Kernel Tracker.
Choose a CeLog zone to log the data to.
CELZONE_MISC
The OS does not log events to CELZONE_MISC unless that zone is turned on. Hence, you can use this zone to turn logging on and off dynamically for your event.
- Or -
CELZONE_ALWAYSON
CELZONE_ALWAYSON cannot be turned off, so logging for your event is always turned on.
Log the data using the ID, data structure, and zone that you have chosen.
The following line shows how use CeLogData to log the data defined by the unique ID you created in step 1.
CeLogData(TRUE, CELID_MY_EVENT, (BYTE*)&MyStructure, sizeof(MyStructure), 0, CELZONE_MISC, 0, FALSE);
This example uses CELZONE_MISC. When the CELZONE_MISC zone is turned on, CeLogData adds your data structure to the log each time your code runs.
Viewing Custom Event Types
When you define a custom event type, instead of using a pre-defined type, the Readlog viewing tool cannot display your event data without modification. Remote Kernel Tracker cannot display custom event types, but can display output from a Readlog extension after appropriate preparation.
When Readlog encounters a custom event type, it prints only the event ID and event size, as shown in the following line of output:
0:01:42.107.225 : ID=8192, Len= 64
To view custom event types
Create a Readlog extension that formats and prints the data in the way you want. For more information, see Writing A Readlog Extension to View Custom Events.
Once you have written your extension, you can use Readlog to process the log file so that Remote Kernel Tracker can also display your data. For more information, see Viewing Output from a Readlog Extension.
See Also
Readlog Viewing Tool | Remote Kernel Tracker
Send Feedback on this topic to the authors