logsui/logsserviceextension/inc/simpledebug.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2006 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 SIMPLELOGGER_H
       
    20 #define SIMPLELOGGER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32def.h>
       
    24 
       
    25 
       
    26 //-----------------------------------------------------------------------------
       
    27 //  USER LOGGING SETTINGS
       
    28 //-----------------------------------------------------------------------------
       
    29 
       
    30 #ifndef _DEBUG
       
    31 
       
    32 /***************************
       
    33 * Logging method variants:
       
    34 *   0 = No logging
       
    35 *   1 = Flogger
       
    36 *   2 = RDebug
       
    37 ***************************/ 
       
    38 
       
    39 #define SLOGGER_LOGGING_METHOD      0   // UREL BUILD
       
    40 
       
    41 #else
       
    42 
       
    43 #ifdef __WINS__
       
    44 #define SLOGGER_LOGGING_METHOD 2   // UDEB BUILD, WINS
       
    45 #else
       
    46 #define SLOGGER_LOGGING_METHOD 2   // UDEB BUILD, HW
       
    47 #endif // __WINS__
       
    48 
       
    49 #endif // _DEBUG
       
    50 
       
    51 
       
    52 //-----------------------------------------------------------------------------
       
    53 //  LOGGING SETTINGS (DO NOT EDIT)
       
    54 //-----------------------------------------------------------------------------
       
    55 
       
    56 #if SLOGGER_LOGGING_METHOD == 1      // Flogger
       
    57 
       
    58 #include <flogger.h>
       
    59 _LIT(KLogFolder,"logsext");
       
    60 _LIT(KLogFile,"logsext.txt");
       
    61 
       
    62 #elif SLOGGER_LOGGING_METHOD == 2    // RDebug
       
    63 
       
    64 #include <e32svr.h>
       
    65 
       
    66 #define DP_TP_PRINT(s) L##s
       
    67 #define DP_STRA_PRINT(s) DP_TP_PRINT(s)
       
    68 #define DP_STR_PRINT(t) DP_STRA_PRINT("[logsExt] ") L##t
       
    69 #define DP_LIT_PRINT(s) TPtrC((const TText *) DP_STR_PRINT(s))
       
    70 
       
    71 #endif
       
    72 
       
    73 
       
    74 
       
    75 
       
    76 //-----------------------------------------------------------------------------
       
    77 //  LOGGING MACROs (DO NOT EDIT)
       
    78 //
       
    79 //  USE THESE MACROS IN YOUR CODE
       
    80 //-----------------------------------------------------------------------------
       
    81 
       
    82 #if SLOGGER_LOGGING_METHOD == 1      // Flogger
       
    83 #define _LOGDES(AA)        { RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, AA ); }
       
    84 #define _LOG(AA)           { RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend, _L(AA) ); }
       
    85 #define _LOGP(AA,BB)       { RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB); }
       
    86 #define _LOGPP(AA,BB,CC)    { RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC); }
       
    87 #define _LOGPPP(AA,BB,CC,DD) { RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC,DD); }
       
    88 
       
    89 #elif SLOGGER_LOGGING_METHOD == 2    // RDebug
       
    90 
       
    91 #define _LOGDES(AA)          { RDebug::Print(AA); }
       
    92 #define _LOG(AA) {RDebug::Print(DP_LIT_PRINT(AA));}
       
    93 #define _LOGP(AA, BB) {RDebug::Print(DP_LIT_PRINT(AA),BB);}
       
    94 #define _LOGPP(AA, BB, CC) RDebug::Print(DP_LIT_PRINT(AA), BB, CC);
       
    95 #define _LOGPPP(AA, BB, CC, DD) RDebug::Print(DP_LIT_PRINT(AA), BB, CC, DD);
       
    96 
       
    97 //#define _LOG(AA)             { RDebug::Print(_L(AA)); }
       
    98 //#define _LOGP(AA,BB)         { RDebug::Print(_L(AA),BB); }
       
    99 //#define _LOGPP(AA,BB,CC)     { RDebug::Print(_L(AA),BB,CC); }
       
   100 //#define _LOGPPP(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
       
   101 
       
   102 #else   // SLOGGER_LOGGING_METHOD == 0 or invalid -> Disable loggings
       
   103 #define _LOGDES(AA)          // Example  HOLOGSTRING( aDes );
       
   104 #define _LOG(AA)             // Example: HOLOGSTRING("Test");
       
   105 #define _LOGP(AA,BB)         // Example: HOLOGSTRING("Test %d", aValue);
       
   106 #define _LOGPP(AA,BB,CC)     // Example: HOLOGSTRING("Test %d %d", aValue1, aValue2);
       
   107 #define _LOGPPP(AA,BB,CC,DD) // Example: HOLOGSTRING("Test %d %d %d", aValue1, aValue2, aValue3);
       
   108 
       
   109 #endif  // SLOGGER_LOGGING_METHOD
       
   110 
       
   111 #endif  // SIMPLELOGGER_H