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