telephonyutils/telephonywatchers/inc/watcherlog.h
branchRCL_3
changeset 65 630d2f34d719
parent 61 17af172ffa5f
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __WATCHERLOG_H__
       
    17 #define __WATCHERLOG_H__
       
    18 
       
    19 /**
       
    20  *  @file
       
    21  *
       
    22  *  Logging macros for the Telephony Watchers. These use the Comms Debug
       
    23  *  Utility framework (aka Flogger V2).
       
    24  *
       
    25  *  To enable logging create a file called "comsdbg.ini" in the Symbian OS
       
    26  *  "C:\Logs\" directory which contains the following lines:
       
    27  *
       
    28  *    MEDIA FILE
       
    29  *    LOG TelWatchers Common
       
    30  *    LOG TelWatchers Indicator
       
    31  *    LOG TelWatchers Signal
       
    32  *
       
    33  *  Each line relates to a particular part of the Telephony Watchers,
       
    34  *  enabling you to log only the interesting bits.
       
    35  *
       
    36  *  By default logging is only present on UDEB builds. To enable UREL logging
       
    37  *  on a device, you will need to rebuild your ROM with UDEB components.
       
    38  *
       
    39  *  To enable logging on a device, place the "comsdbg.ini" file in the ROM
       
    40  *  under the "Z:\Logs\" directory. The log file will be written in the
       
    41  *  "C:\Logs\" directory on the device.
       
    42  *
       
    43  *  To enable logging to the serial port change the "MEDIA FILE" line to
       
    44  *  "MEDIA SERIAL::1" or "MEDIA SERIAL::2". Note that this may no longer
       
    45  *  work due to a change of feature implementation in the Comms Debug
       
    46  *  Framework.
       
    47  *
       
    48  *  If you wish to have individual logs for each component, then use the
       
    49  *  extractlog.pl utility found in the %EPOCROOT%\Epoc32\Tools\ directory. E.g.
       
    50  *
       
    51  *    extractlog.pl \EPOC32\WINSCW\C\LOGS\LOG.TXT
       
    52  *
       
    53  *  @internalComponent
       
    54  */
       
    55 
       
    56 #include <comms-infras/commsdebugutility.h>
       
    57 
       
    58 #ifdef _DEBUG
       
    59 #define _WATCHER_LOGGING_ENABLED
       
    60 #endif
       
    61 
       
    62 
       
    63 #ifdef _WATCHER_LOGGING_ENABLED
       
    64 
       
    65 _LIT8(KTelWatcherSubSystem, "TelWatchers");
       
    66 
       
    67 #define WATCHERFLOG1(N,A)                { \
       
    68 									     _LIT8(KLogString, A); \
       
    69 									     __FLOG_STATIC0(KTelWatcherSubSystem,(N),KLogString); \
       
    70 									     }
       
    71 #define WATCHERFLOG2(N,A,B)              { \
       
    72 									     _LIT8(KLogString, A); \
       
    73 									     __FLOG_STATIC1(KTelWatcherSubSystem,(N),KLogString,(B)); \
       
    74 									     }
       
    75 #define WATCHERFLOG3(N,A,B,C)            { \
       
    76 									     _LIT8(KLogString, A); \
       
    77 									     __FLOG_STATIC2(KTelWatcherSubSystem,(N),KLogString,(B),(C)); \
       
    78 									     }
       
    79 #define WATCHERFLOG4(N,A,B,C,D)          { \
       
    80 									     _LIT8(KLogString, A); \
       
    81 									     __FLOG_STATIC3(KTelWatcherSubSystem,(N),KLogString,(B),(C),(D)); \
       
    82 									     }
       
    83 #define WATCHERFLOG5(N,A,B,C,D,E)        { \
       
    84 									     _LIT8(KLogString, A); \
       
    85 									     __FLOG_STATIC4(KTelWatcherSubSystem,(N),KLogString,(B),(C),(D),(E)); \
       
    86 									     }
       
    87 #define WATCHERFLOG6(N,A,B,C,D,E,F)      { \
       
    88 									     _LIT8(KLogString, A); \
       
    89 									     __FLOG_STATIC5(KTelWatcherSubSystem,(N),KLogString,(B),(C),(D),(E),(F)); \
       
    90 									     }
       
    91 #define WATCHERFLOG7(N,A,B,C,D,E,F,G)    { \
       
    92 									     _LIT8(KLogString, A); \
       
    93 									     __FLOG_STATIC6(KTelWatcherSubSystem,(N),KLogString,(B),(C),(D),(E),(F),(G)); \
       
    94 									     }
       
    95 #define WATCHERFLOG8(N,A,B,C,D,E,F,G,H)  { \
       
    96 									     _LIT8(KLogString, A); \
       
    97 									     __FLOG_STATIC7(KTelWatcherSubSystem,(N),KLogString,(B),(C),(D),(E),(F),(G),(H)); \
       
    98 									     }
       
    99 
       
   100 _LIT8(KTelWatcherCommon, "Common");
       
   101 _LIT8(KTelWatcherIndicator, "Indicator");
       
   102 _LIT8(KTelWatcherSignal, "Signal");
       
   103 
       
   104 
       
   105 #define LOGCOMMON1(A)                      WATCHERFLOG1(KTelWatcherCommon,A)
       
   106 #define LOGCOMMON2(A,B)                    WATCHERFLOG2(KTelWatcherCommon,A,(B))
       
   107 #define LOGCOMMON3(A,B,C)                  WATCHERFLOG3(KTelWatcherCommon,A,(B),(C))
       
   108 #define LOGCOMMON4(A,B,C,D)                WATCHERFLOG4(KTelWatcherCommon,A,(B),(C),(D))
       
   109 #define LOGCOMMON5(A,B,C,D,E)              WATCHERFLOG5(KTelWatcherCommon,A,(B),(C),(D),(E))
       
   110 #define LOGCOMMON6(A,B,C,D,E,F)            WATCHERFLOG6(KTelWatcherCommon,A,(B),(C),(D),(E),(F))
       
   111 #define LOGCOMMON7(A,B,C,D,E,F,G)          WATCHERFLOG7(KTelWatcherCommon,A,(B),(C),(D),(E),(F),(G))
       
   112 #define LOGCOMMON8(A,B,C,D,E,F,G,H)        WATCHERFLOG8(KTelWatcherCommon,A,(B),(C),(D),(E),(F),(G),(H))
       
   113 #define LOGCOMMONTIMESTAMP()		       { \
       
   114 									       TTime  now; \
       
   115 									       now.UniversalTime(); \
       
   116 									       TDateTime dateTime(now.DateTime()); \
       
   117 									       LOGCOMMON5("TimeStamp=%02d:%02d:%02d.%06d", \
       
   118 									       dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond()); \
       
   119 									       }
       
   120 
       
   121 #define LOGINDICATOR1(A)                   WATCHERFLOG1(KTelWatcherIndicator,A)
       
   122 #define LOGINDICATOR2(A,B)                 WATCHERFLOG2(KTelWatcherIndicator,A,(B))
       
   123 #define LOGINDICATOR3(A,B,C)               WATCHERFLOG3(KTelWatcherIndicator,A,(B),(C))
       
   124 #define LOGINDICATOR4(A,B,C,D)             WATCHERFLOG4(KTelWatcherIndicator,A,(B),(C),(D))
       
   125 #define LOGINDICATOR5(A,B,C,D,E)           WATCHERFLOG5(KTelWatcherIndicator,A,(B),(C),(D),(E))
       
   126 #define LOGINDICATOR6(A,B,C,D,E,F)         WATCHERFLOG6(KTelWatcherIndicator,A,(B),(C),(D),(E),(F))
       
   127 #define LOGINDICATOR7(A,B,C,D,E,F,G)       WATCHERFLOG7(KTelWatcherIndicator,A,(B),(C),(D),(E),(F),(G))
       
   128 #define LOGINDICATOR8(A,B,C,D,E,F,G,H)     WATCHERFLOG8(KTelWatcherIndicator,A,(B),(C),(D),(E),(F),(G),(H))
       
   129 #define LOGINDICATORTIMESTAMP()	           { \
       
   130 									       TTime  now; \
       
   131 									       now.UniversalTime(); \
       
   132 									       TDateTime dateTime(now.DateTime()); \
       
   133 									       LOGINDICATOR5("TimeStamp=%02d:%02d:%02d.%06d", \
       
   134 									       dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond()); \
       
   135 									       }
       
   136 
       
   137 #define LOGSIGNAL1(A)                      WATCHERFLOG1(KTelWatcherSignal,A)
       
   138 #define LOGSIGNAL2(A,B)                    WATCHERFLOG2(KTelWatcherSignal,A,(B))
       
   139 #define LOGSIGNAL3(A,B,C)                  WATCHERFLOG3(KTelWatcherSignal,A,(B),(C))
       
   140 #define LOGSIGNAL4(A,B,C,D)                WATCHERFLOG4(KTelWatcherSignal,A,(B),(C),(D))
       
   141 #define LOGSIGNAL5(A,B,C,D,E)              WATCHERFLOG5(KTelWatcherSignal,A,(B),(C),(D),(E))
       
   142 #define LOGSIGNAL6(A,B,C,D,E,F)            WATCHERFLOG6(KTelWatcherSignal,A,(B),(C),(D),(E),(F))
       
   143 #define LOGSIGNAL7(A,B,C,D,E,F,G)          WATCHERFLOG7(KTelWatcherSignal,A,(B),(C),(D),(E),(F),(G))
       
   144 #define LOGSIGNAL8(A,B,C,D,E,F,G,H)        WATCHERFLOG8(KTelWatcherSignal,A,(B),(C),(D),(E),(F),(G),(H))
       
   145 #define LOGSIGNALTIMESTAMP()		       { \
       
   146 									       TTime  now; \
       
   147 									       now.UniversalTime(); \
       
   148 									       TDateTime dateTime(now.DateTime()); \
       
   149 									       LOGSIGNAL5("TimeStamp=%02d:%02d:%02d.%06d", \
       
   150 									       dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond()); \
       
   151 									       }
       
   152 
       
   153 #else  // _WATCHER_LOGGING_ENABLED
       
   154 
       
   155 #define LOGCOMMON1(A)
       
   156 #define LOGCOMMON2(A,B)
       
   157 #define LOGCOMMON3(A,B,C)
       
   158 #define LOGCOMMON4(A,B,C,D)
       
   159 #define LOGCOMMON5(A,B,C,D,E)
       
   160 #define LOGCOMMON6(A,B,C,D,E,F)
       
   161 #define LOGCOMMON7(A,B,C,D,E,F,G)
       
   162 #define LOGCOMMON8(A,B,C,D,E,F,G,H)
       
   163 #define LOGCOMMONTIMESTAMP()
       
   164 
       
   165 #define LOGINDICATOR1(A)
       
   166 #define LOGINDICATOR2(A,B)
       
   167 #define LOGINDICATOR3(A,B,C)
       
   168 #define LOGINDICATOR4(A,B,C,D)
       
   169 #define LOGINDICATOR5(A,B,C,D,E)
       
   170 #define LOGINDICATOR6(A,B,C,D,E,F)
       
   171 #define LOGINDICATOR7(A,B,C,D,E,F,G)
       
   172 #define LOGINDICATOR8(A,B,C,D,E,F,G,H)
       
   173 #define LOGINDICATORTIMESTAMP()
       
   174 
       
   175 #define LOGSIGNAL1(A)
       
   176 #define LOGSIGNAL2(A,B)
       
   177 #define LOGSIGNAL3(A,B,C)
       
   178 #define LOGSIGNAL4(A,B,C,D)
       
   179 #define LOGSIGNAL5(A,B,C,D,E)
       
   180 #define LOGSIGNAL6(A,B,C,D,E,F)
       
   181 #define LOGSIGNAL7(A,B,C,D,E,F,G)
       
   182 #define LOGSIGNAL8(A,B,C,D,E,F,G,H)
       
   183 #define LOGSIGNALTIMESTAMP()
       
   184 
       
   185 #endif	// _WATCHER_LOGGING_ENABLED
       
   186 
       
   187 #endif // __WATCHERLOG_H__
       
   188