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