vmbx/vmbxengine/inc/vmbxlogger.h
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     1 /*
       
     2 * Copyright (c) 2007 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:  Provides macros for logging
       
    15 *  Interface   : Private
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __VMBXLOGGER_H__
       
    20 #define __VMBXLOGGER_H__
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32def.h>
       
    24 
       
    25 /*
       
    26 -----------------------------------------------------------------------------
       
    27 
       
    28     USER LOG SELECTION
       
    29 
       
    30 -----------------------------------------------------------------------------
       
    31 */
       
    32 
       
    33 #ifndef _DEBUG
       
    34 
       
    35 /***************************
       
    36 * Logging method variants:
       
    37 * 0 = No logging
       
    38 * 1 = Flogger
       
    39 * 2 = RDebug
       
    40 ***************************/
       
    41 
       
    42 #define VMB_LOGGING_METHOD      0   // UREL BUILD
       
    43 
       
    44 #else
       
    45 
       
    46 #ifdef __WINS__
       
    47 #define VMB_LOGGING_METHOD      1   // UDEB BUILD, WINS
       
    48 #else
       
    49 #define VMB_LOGGING_METHOD      2   // UDEB BUILD, HW
       
    50 #endif // __WINS__
       
    51 
       
    52 #endif // _DEBUG
       
    53 
       
    54 
       
    55 // Next is for backward compatibility
       
    56 #if VMB_LOGGING_METHOD > 0
       
    57     #define VMB_LOGGING_ENABLED
       
    58 #endif //VMB_LOGGING_METHOD
       
    59 
       
    60 
       
    61 /**
       
    62 *
       
    63 * FLOGGER SETTINGS
       
    64 *
       
    65 */
       
    66 #if VMB_LOGGING_METHOD == 1      // Flogger
       
    67 
       
    68     #include <flogger.h>
       
    69 
       
    70     _LIT(KVMBLogFolder, "VMBX");
       
    71     _LIT(KVMBLogFile, "VMBX.TXT");
       
    72 
       
    73 #elif VMB_LOGGING_METHOD == 2    // RDebug
       
    74 
       
    75     #include <e32svr.h>
       
    76 
       
    77 #endif //VMB_LOGGING_METHOD
       
    78 
       
    79 
       
    80 /**
       
    81 *
       
    82 * LOGGING MACROs
       
    83 *
       
    84 * USE THESE MACROS IN YOUR CODE !
       
    85 *
       
    86 */
       
    87 
       
    88 #if VMB_LOGGING_METHOD == 1      // Flogger
       
    89 
       
    90 #define VMBLOGTEXT(AAA) /*lint -save -e960 */              { RFileLogger::Write(KVMBLogFolder(),KVMBLogFile(),EFileLoggingModeAppend,AAA); } /*lint -restore */
       
    91 #define VMBLOGSTRING(AAA) /*lint -save -e960 */            { _LIT(tempLogDes,AAA); RFileLogger::Write(KVMBLogFolder(),KVMBLogFile(),EFileLoggingModeAppend,tempLogDes()); } /*lint -restore */
       
    92 #define VMBLOGSTRING2(AAA,BBB) /*lint -save -e960 -e437 */ { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KVMBLogFolder(),KVMBLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } /*lint -restore */
       
    93 #define VMBLOGSTRING3(AAA,BBB,CCC) /*lint -save -e960 */   { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KVMBLogFolder(),KVMBLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } /*lint -restore */
       
    94 
       
    95 #elif VMB_LOGGING_METHOD == 2    // RDebug
       
    96 
       
    97 #define VMBLOGTEXT(AAA)              RDebug::Print(AAA);
       
    98 #define VMBLOGSTRING(AAA)            RDebug::Print(_L(AAA));
       
    99 #define VMBLOGSTRING2(AAA,BBB)       RDebug::Print(_L(AAA),BBB);
       
   100 #define VMBLOGSTRING3(AAA,BBB,CCC)   RDebug::Print(_L(AAA),BBB,CCC);
       
   101 
       
   102 #else    // VMB_LOGGING_METHOD == 0 or invalid
       
   103 
       
   104 // Example: VMBLOGTEXT(own_desc);
       
   105 #define VMBLOGTEXT(AAA)
       
   106 // Example: VMBLOGSTRING("Test");
       
   107 #define VMBLOGSTRING(AAA)
       
   108 // Example: VMBLOGSTRING("Test %i", aValue);
       
   109 #define VMBLOGSTRING2(AAA,BBB)
       
   110 // Example: VMBLOGSTRING("Test %i %i", aValue1, aValue2);
       
   111 #define VMBLOGSTRING3(AAA,BBB,CCC)
       
   112 
       
   113 #endif  // VMB_LOGGING_METHOD
       
   114 
       
   115 #endif    // VMBXLOGGER_H