phoneuis/Ussd/inc/UssdLogger.h
branchRCL_3
changeset 5 2a26698d78ba
equal deleted inserted replaced
4:24062c24fe38 5:2a26698d78ba
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Logger headerfile for CbsServer
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef USSDLOGGER_H
       
    19 #define USSDLOGGER_H
       
    20 
       
    21 /* 
       
    22 -----------------------------------------------------------------------------
       
    23     LOGGIN MODE SELECTION
       
    24 -----------------------------------------------------------------------------
       
    25 */
       
    26 #ifndef _DEBUG
       
    27     // UREL BUILD:
       
    28     #define USSDUI_LOGGING_METHOD 0   // No logging in UREL builds
       
    29 #else
       
    30     // UDEB BUILD:
       
    31     // 0 = No logging, 
       
    32     // 1 = Flogger, 
       
    33     // 2 = RDebug
       
    34     #define USSDUI_LOGGING_METHOD 2   
       
    35 #endif //_DEBUG
       
    36 
       
    37 /* 
       
    38 -----------------------------------------------------------------------------
       
    39     FILE LOGGING SETTINGS
       
    40 -----------------------------------------------------------------------------
       
    41 */
       
    42 #if USSDUI_LOGGING_METHOD == 1      // Flogger
       
    43     #include <flogger.h>
       
    44     _LIT(KCbsLogFolder, "ussdui");
       
    45     _LIT(KCbsLogFile, "ussdui.txt");
       
    46 
       
    47 #elif USSDUI_LOGGING_METHOD == 2    // RDebug
       
    48 
       
    49     #include <e32svr.h>
       
    50 
       
    51 #endif //USSDUI_LOGGING_METHOD
       
    52 
       
    53 /*
       
    54 -----------------------------------------------------------------------------
       
    55     IMPLEMENTATION OF THE LOGGING MACROs
       
    56     USE THESE MACROS IN YOUR CODE
       
    57 ----------------------------------------------------------------------------
       
    58 */
       
    59 
       
    60 
       
    61 #if USSDUI_LOGGING_METHOD == 1      // Flogger
       
    62 
       
    63 #define _LOGTEXT(AAA) /*lint -save -e960 */ { RFileLogger::Write(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,AAA); } /*lint -restore */
       
    64 #define _LOGSTRING(AAA) /*lint -save -e960 */ { _LIT(tempLogDes,AAA); RFileLogger::Write(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,tempLogDes()); } /*lint -restore */
       
    65 #define _LOGSTRING2(AAA,BBB) /*lint -save -e960 -e437 */ { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } /*lint -restore */
       
    66 #define _LOGSTRING3(AAA,BBB,CCC) /*lint -save -e960 */ { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } /*lint -restore */
       
    67 
       
    68 #elif USSDUI_LOGGING_METHOD == 2    // RDebug
       
    69 
       
    70 #define _LOGTEXT(AAA)              RDebug::Print(AAA);
       
    71 #define _LOGSTRING(AAA)            RDebug::Print(_L(AAA));
       
    72 #define _LOGSTRING2(AAA,BBB)       RDebug::Print(_L(AAA),BBB);
       
    73 #define _LOGSTRING3(AAA,BBB,CCC)   RDebug::Print(_L(AAA),BBB,CCC);
       
    74 
       
    75 #else    // USSDUI_LOGGING_METHOD == 0 or invalid
       
    76 
       
    77 // Example: _LOGTEXT(own_desc);
       
    78 #define _LOGTEXT(AAA)              
       
    79 // Example: _LOGSTRING("Test");
       
    80 #define _LOGSTRING(AAA)            
       
    81 // Example: _LOGSTRING("Test %i", aValue);
       
    82 #define _LOGSTRING2(AAA,BBB)       
       
    83 // Example: _LOGSTRING("Test %i %i", aValue1, aValue2);
       
    84 #define _LOGSTRING3(AAA,BBB,CCC)   
       
    85 
       
    86 #endif // USSDUI_LOGGING_METHOD
       
    87 
       
    88 #endif // USSDLOGGER_H
       
    89             
       
    90 // End of File