diff -r 51a74ef9ed63 -r ae94777fff8f Symbian3/SDK/Source/GUID-2022F702-9899-5798-8932-D70119C7177D.dita --- a/Symbian3/SDK/Source/GUID-2022F702-9899-5798-8932-D70119C7177D.dita Wed Mar 31 11:11:55 2010 +0100 +++ b/Symbian3/SDK/Source/GUID-2022F702-9899-5798-8932-D70119C7177D.dita Fri Jun 11 12:39:03 2010 +0100 @@ -1,90 +1,90 @@ - - - - - -Setting -Up A Log Engine Client This tutorial describes how to set up a Log Engine client. -
Introduction

If -you are certain that you are coding for a platform with logging functionality -you create a custom class with some such name as CMyLogEngine. -It should have members of the classes CLogClient, CLogViewEvent, CLogViewRecent and CLogFilter and an observer of some kind. The functions of your -custom class will use the functionality of these classes by calls to the member -objects.

If you are not certain that your platform will provide logging -functionality you must use a log wrapper framework. Write a custom class to -use the log wrapper functionality with some such name as myLogWrapper. -It should have two members which own CLogWrapper and CLogClient objects. -In the constructor function of myLogWrapper call the ClientAvailable() function -of CLogWrapper to determine whether logging functionality -is present. If so, construct the CLogClient member: if -not, leave. The effect of this is that calls to the log client functionality -of myLogWrapper will access an actual log client if the functionality -is available. However, if the functionality is not available calls to the -log client functionality will either have no effect or else leave as in this -example code.

-
Procedure
    -
  1. Create a custom class CMyLogEngine

  2. -
  3. Declare the members CLogClient, CLogViewEvent, CLogViewRecent and CLogFilter in the header -file of the client application

  4. -
  5. Declare ConstrucL() function -in the header file of the client application

  6. -
  7. Implement ConstructL() function

      -
    1. Establish a connection -to the Log Engine

      iLogClient = CLogClient::NewL(iFs);

    2. -
    3. get the log events using CLogViewEvent

      iLogViewEvent = CLogViewEvent::NewL(*iLogClient);

    4. -
    5. get the log of recent -events using CLogViewRecent

      iLogViewRecent = CLogViewRecent::NewL(*iLogClient);

    6. -
    7. add a log filter using ClogFilter

      iLogFilter = CLogFilter::NewL();

    8. -
  8. -
-
Result

The client applications can use the log -events to be displayed to the user or for other used as a data for further -processing.

-Log engine -client example

Example code for a Log Engine client on a platform -with logging functionality

void CMyLogEngine::ConstructL() - { - - // Establish connection to log engine - iLogClient = CLogClient::NewL(iFs); - - // Log view and view for recent events with standard priority - iLogViewEvent = CLogViewEvent::NewL(*iLogClient); - iLogViewRecent = CLogViewRecent::NewL(*iLogClient); - - // Filter for events - iLogFilter = CLogFilter::NewL(); -

Example code for a Log Engine client using a wrapper framework

void CMyLogWrapper::ConstructL(RFs& aFs) - { - - // create the CLogWrapper to forward requests to. - iLogWrapper = CLogWrapper::NewL(aFs); - - if (iLogWrapper->ClientAvailable()) - { - iLogClient = static_cast<CLogClient*>(&iLogWrapper->Log()); - } - else - { - User::Leave(KErrNotSupported); - } - } - -

You can now use myLogWrapper as if it was -a log client.

-
-Maintaining -Log Events -Requesting -Log Engine Notifications -Displaying -Log Events -Configuring -Log Engine + + + + + +Setting +Up A Log Engine Client This tutorial describes how to set up a Log Engine client. +
Introduction

If +you are certain that you are coding for a platform with logging functionality +you create a custom class with some such name as CMyLogEngine. +It should have members of the classes CLogClient, CLogViewEvent, CLogViewRecent and CLogFilter and an observer of some kind. The functions of your +custom class will use the functionality of these classes by calls to the member +objects.

If you are not certain that your platform will provide logging +functionality you must use a log wrapper framework. Write a custom class to +use the log wrapper functionality with some such name as myLogWrapper. +It should have two members which own CLogWrapper and CLogClient objects. +In the constructor function of myLogWrapper call the ClientAvailable() function +of CLogWrapper to determine whether logging functionality +is present. If so, construct the CLogClient member: if +not, leave. The effect of this is that calls to the log client functionality +of myLogWrapper will access an actual log client if the functionality +is available. However, if the functionality is not available calls to the +log client functionality will either have no effect or else leave as in this +example code.

+
Procedure
    +
  1. Create a custom class CMyLogEngine

  2. +
  3. Declare the members CLogClient, CLogViewEvent, CLogViewRecent and CLogFilter in the header +file of the client application

  4. +
  5. Declare ConstrucL() function +in the header file of the client application

  6. +
  7. Implement ConstructL() function

      +
    1. Establish a connection +to the Log Engine

      iLogClient = CLogClient::NewL(iFs);

    2. +
    3. get the log events using CLogViewEvent

      iLogViewEvent = CLogViewEvent::NewL(*iLogClient);

    4. +
    5. get the log of recent +events using CLogViewRecent

      iLogViewRecent = CLogViewRecent::NewL(*iLogClient);

    6. +
    7. add a log filter using CLogFilter

      iLogFilter = CLogFilter::NewL();

    8. +
  8. +
+
Result

The +client applications can use the log events to be displayed to the user or +for other used as a data for further processing.

+Log engine +client example

Example code for a Log Engine client on a platform +with logging functionality

void CMyLogEngine::ConstructL() + { + + // Establish connection to log engine + iLogClient = CLogClient::NewL(iFs); + + // Log view and view for recent events with standard priority + iLogViewEvent = CLogViewEvent::NewL(*iLogClient); + iLogViewRecent = CLogViewRecent::NewL(*iLogClient); + + // Filter for events + iLogFilter = CLogFilter::NewL(); +

Example code for a Log Engine client using a wrapper framework

void CMyLogWrapper::ConstructL(RFs& aFs) + { + + // create the CLogWrapper to forward requests to. + iLogWrapper = CLogWrapper::NewL(aFs); + + if (iLogWrapper->ClientAvailable()) + { + iLogClient = static_cast<CLogClient*>(&iLogWrapper->Log()); + } + else + { + User::Leave(KErrNotSupported); + } + } + +

You can now use myLogWrapper as if it was +a log client.

+
+Maintaining +Log Events +Requesting +Log Engine Notifications +Displaying +Log Events +Configuring +Log Engine
\ No newline at end of file