Displaying Log Events

This tutorial describes how to display log events.

You create a view to be displayed in the viewer application by creating a CLogViewEvent or a CLogViewRecent . Both classes select entries from the log, usually subject to the constraint of a filter.

CLogViewEvent and CLogViewRecent inherit functions from CLogView which let you navigate through the items in the view:

  • Event()

  • FirstL()

  • LastL()

  • NextL()

  • PreviousL()

  1. Create a CLogViewEvent or a CLogViewRecent class

  2. Set a filter for the logs
            
             
            
            iLogViewEvent->SetFilterL(*iLogFilter,iStatus)
           
    A CLogViewRecent has additional functionality to identify and filter out duplicate events. A view is a purely virtual table and its add and delete functions have no effect on the log itself.

  3. Create a view from the Log Engine using Event() A view is a list of events ordered chronologically, earliest first. A view always has a current event, which you retrieve with Event() . When you create a view the current event is the first event, and you navigate through the list using the other functions which take a TRequestStatus as argument.

    1. To get the first event in the view call

                 if(CViewEvent.FirstL(aStatus))
        {
        User::WaitForRequest(aStatus); 
        CLogEvent e = iViewEvent.Event(); 
        }
                

    2. To get the last event in the view call

                 if(CViewEvent.LastL(aStatus))
        {
        User::WaitForRequest(aStatus); 
        CLogEvent e = iViewEvent.Event(); 
        };
                

    3. To get the last event in the view call

                 if(CViewEvent.FirstL(aStatus))
        {
        User::WaitForRequest(aStatus); 
        CLogEvent e = iViewEvent.Event(); 
        }
                

    4. and then inside a loop call

                 while(CViewEvent.NextL(aStatus))
        {
        User::WaitForRequest(aStatus); 
        CLogEvent e = iViewEvent.Event(); 
        }
                

  4. The view can be displayed to the user.

A recent view is similar to an event view but is designed specifically for the purpose of displaying such recent events as the distinct voice calls a device user has received since the last time of checking. In a recent view, the first event is the most recent.