Share via


Capturing Events With Custom Data Structures (Windows Embedded CE 6.0)

1/5/2010

You can log any type of data, including any data structure, to CeLog.

To log any data structure with CeLog

  1. 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 Viewing Tool or Kernel Tracker.

  2. Choose one of the following CeLog zones to log the data to.

    • CELZONE_MISC
      The OS does not log events to CELZONE_MISC unless that zone is explicitly 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.
  3. 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. In addition, 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

See Also

Concepts

Kernel Tracker

Other Resources

Logging Your Own CeLog Events
Readlog Viewing Tool