imstutils/imconnectionprovider/inc/icplogger.h
changeset 0 5e5d6b214f4f
child 13 76f25fb7a6a1
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2008 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 
       
    20 #ifndef __ICPLOGGER_H__
       
    21 #define __ICPLOGGER_H__
       
    22 
       
    23 #define SCP_TP_PRINT(s) L##s
       
    24 #define SCP_STRA_PRINT(s) SCP_TP_PRINT(s)
       
    25 #define SCP_STR_PRINT(t) SCP_STRA_PRINT("[SCP]") L##t
       
    26 #define SCP_LIT_PRINT(s) TPtrC((const TText *) SCP_STR_PRINT(s))
       
    27 #define SCP_LIT_CONVERT(s) TPtrC((const TText *)(s))
       
    28 
       
    29 //-----------------------------------------------------------------------------
       
    30 //  LOGGING MACROs 
       
    31 //-----------------------------------------------------------------------------
       
    32 
       
    33 // Logging method is defined in the mmp file
       
    34 
       
    35 #ifdef SCP_LOGGING_0
       
    36 
       
    37     #define ICPLOGSTRING(a)           
       
    38     #define ICPLOGSTRING2(a,b)     
       
    39     #define ICPLOGSTRING3(a,b,c)    
       
    40     #define ICPLOGSTRING4(a,b,c,d)
       
    41     #define ICPLOGSTRING5(a,b,c,d,e) 
       
    42 
       
    43 #endif
       
    44 
       
    45 #ifdef SCP_LOGGING_1
       
    46     #ifdef _DEBUG
       
    47         #include <e32def.h> 
       
    48         #include <e32svr.h>   
       
    49         #define ICPLOGSTRING(a)          { RDebug::Print(SCP_LIT_PRINT(a)); } 
       
    50         #define ICPLOGSTRING2(a,b)       { RDebug::Print(SCP_LIT_PRINT(a),b); } 
       
    51         #define ICPLOGSTRING3(a,b,c)     { RDebug::Print(SCP_LIT_PRINT(a),b,c); } 
       
    52         #define ICPLOGSTRING4(a,b,c,d)   { RDebug::Print(SCP_LIT_PRINT(a),b,c,d); }  
       
    53         #define ICPLOGSTRING5(a,b,c,d,e) { RDebug::Print(SCP_LIT_PRINT(a),b,c,d,e); }     
       
    54     #else
       
    55         #define ICPLOGSTRING(a)           
       
    56         #define ICPLOGSTRING2(a,b)     
       
    57         #define ICPLOGSTRING3(a,b,c)    
       
    58         #define ICPLOGSTRING4(a,b,c,d) 
       
    59         #define ICPLOGSTRING5(a,b,c,d,e) 
       
    60     #endif
       
    61 #endif
       
    62 
       
    63 #ifdef SCP_LOGGING_2
       
    64     //#ifdef _DEBUG
       
    65     	#define ICPLOGSTRING(a) { IcpDebugWriteFormat(SCP_LIT_PRINT(a)); } 
       
    66     	#define ICPLOGSTRING2(a,b) { IcpDebugWriteFormat(SCP_LIT_PRINT(a),b); } 
       
    67     	#define ICPLOGSTRING3(a,b,c) { IcpDebugWriteFormat(SCP_LIT_PRINT(a),b,c); }    
       
    68     	#define ICPLOGSTRING4(a,b,c,d) { IcpDebugWriteFormat(SCP_LIT_PRINT(a),b,c,d); };
       
    69         #define ICPLOGSTRING5(a,b,c,d,e) { IcpDebugWriteFormat(SCP_LIT_PRINT(a),b,c,d,e); };     
       
    70     /*#else
       
    71         #define ICPLOGSTRING(a)           
       
    72         #define ICPLOGSTRING2(a,b)     
       
    73         #define ICPLOGSTRING3(a,b,c)    
       
    74         #define ICPLOGSTRING4(a,b,c,d) 
       
    75         #define ICPLOGSTRING5(a,b,c,d,e) 
       
    76     #endif */
       
    77 #endif
       
    78 
       
    79 #ifdef SCP_LOGGING_3 
       
    80     #ifdef _DEBUG   
       
    81         #include <e32def.h> 
       
    82         #include <e32svr.h>   
       
    83         #define ICPLOGSTRING(a)          { RDebug::Print(SCP_LIT_PRINT(a));\
       
    84                                            IcpDebugWriteFormat(SCP_LIT_PRINT(a)); } 
       
    85         #define ICPLOGSTRING2(a,b)       { RDebug::Print(SCP_LIT_PRINT(a),b);\
       
    86                                            IcpDebugWriteFormat(SCP_LIT_PRINT(a),b); } 
       
    87         #define ICPLOGSTRING3(a,b,c)     { RDebug::Print(SCP_LIT_PRINT(a),b,c);\
       
    88                                            IcpDebugWriteFormat(SCP_LIT_PRINT(a),b,c); } 
       
    89         #define ICPLOGSTRING4(a,b,c,d)   { RDebug::Print(SCP_LIT_PRINT(a),b,c,d);\
       
    90                                            IcpDebugWriteFormat(SCP_LIT_PRINT(a),b,c,d); }  
       
    91         #define ICPLOGSTRING5(a,b,c,d,e) { RDebug::Print(SCP_LIT_PRINT(a),b,c,d,e);\
       
    92                                            IcpDebugWriteFormat(SCP_LIT_PRINT(a),b,c,d,e); }     
       
    93     #else
       
    94         #define ICPLOGSTRING(a)           
       
    95         #define ICPLOGSTRING2(a,b)     
       
    96         #define ICPLOGSTRING3(a,b,c)    
       
    97         #define ICPLOGSTRING4(a,b,c,d)
       
    98         #define ICPLOGSTRING5(a,b,c,d,e) 
       
    99     #endif     
       
   100 #endif
       
   101 
       
   102 #include <flogger.h>
       
   103 
       
   104 inline void IcpDebugWriteFormat(TRefByValue<const TDesC> aFmt,...)
       
   105     {
       
   106     _LIT(KDir, "icp");
       
   107     _LIT(KName, "icp.log");
       
   108 
       
   109     // take the ellipsis parameters
       
   110     VA_LIST args;
       
   111     VA_START(args,aFmt);
       
   112     RFileLogger::WriteFormat(KDir, KName, EFileLoggingModeAppend, aFmt, args);
       
   113     VA_END(args);
       
   114     }
       
   115 
       
   116 #endif  // __SCPLOGGER_H__