realtimenetprots/sipfw/ProfileAgent/Profile/Inc/SipProfileLog.h
changeset 0 307788aac0a8
child 55 36ea1f90a3d8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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:
       
    15 * Name        : sipprofilelog.h
       
    16 * Part of     : SIP Profile Server
       
    17 * Interface   : private
       
    18 * Macros for logging
       
    19 * Version     : 1.0
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 /**
       
    27  @internalComponent
       
    28 */
       
    29 
       
    30 #ifndef SIPPROFILELOG_H
       
    31 #define SIPPROFILELOG_H
       
    32 
       
    33 #include <e32std.h>    
       
    34 
       
    35 #ifdef _DEBUG
       
    36     // RFileLogger has been redefined in Commsdebugutility.H
       
    37     // This is a bug in Symbian 9.5.
       
    38     // Using __FLOG_ACTIVE from Commsdebugutility.H to avoid build break
       
    39    #if !defined(CPPUNIT_TEST)
       
    40         // Comment the following line to turn off all kind of logging:
       
    41         #define USE_SIP_PROFILE_LOGS
       
    42     #endif
       
    43  
       
    44 #endif
       
    45 
       
    46 
       
    47 #ifdef USE_SIP_PROFILE_LOGS
       
    48 // CLASS DECLARATION
       
    49 
       
    50 	/**
       
    51  	* Class provides logging through RDebug (or RFileLogger) in debug builds.
       
    52  	* 'SIPProfile: ' is added automatically in front of every logged line.
       
    53  	*/
       
    54     class TSIPProfileDebug
       
    55 	    {
       
    56 	    public:
       
    57 			inline static void Print( const TDesC16& aStr );
       
    58 
       
    59 			inline static void Print( const TDesC16& aStr1,
       
    60 				const TDesC16& aStr2 );
       
    61 
       
    62 			inline static void Print( const TDesC16& aStr, TUint32 aValue );
       
    63 
       
    64 			inline static void Print( const TDesC16& aStr, TUint32 aValue1,
       
    65 				TUint32 aValue2 );
       
    66 
       
    67 			inline static void Print(const TDesC16& aStr, TUint32 aValue1, 
       
    68 				TUint32 aValue2, TUint32 aValue3);
       
    69 
       
    70 			inline static void Print(const TDesC16& aStr1,
       
    71 				const TDesC8& aStr2);
       
    72 			private:
       
    73 			inline static TBool LogDirExists( const TDesC& aPath );
       
    74 
       
    75 			inline static void WriteToFile( const TDesC& aStr );
       
    76 	
       
    77 			inline static void WriteLog( const TDesC& aStr );
       
    78 	    };
       
    79 
       
    80 	#include "SipProfileLog.inl"
       
    81 
       
    82 	/**
       
    83  	* Macro for logging single string
       
    84  	* PROFILE_DEBUG1("Hello")
       
    85  	* Note, max length of printed line 256 characters
       
    86  	*/ 
       
    87 	#define PROFILE_DEBUG1( a ) { TSIPProfileDebug::Print( _L( a ) ); }
       
    88 
       
    89 	/**
       
    90  	* Macro for logging two strings
       
    91  	* PROFILE_DEBUG2("Hello", "Back")
       
    92  	* Note, max length of printed line 256 characters
       
    93  	*/ 
       
    94 	#define PROFILE_DEBUG2( a, b ) { TSIPProfileDebug::Print( _L( a ), _L( b ) ); }
       
    95 
       
    96 	/**
       
    97  	* Macro for logging a string and integer
       
    98  	* PROFILE_DEBUG3("Hello", 1)
       
    99  	* Note, max length of printed line 256 characters
       
   100  	*/ 
       
   101 	#define PROFILE_DEBUG3( a, b ) { TSIPProfileDebug::Print( _L( a ), b ); }
       
   102 
       
   103 	/**
       
   104  	* Macro for logging a string and 2 integers
       
   105  	* PROFILE_DEBUG4("Hello", 1, 2)
       
   106  	* Note, max length of printed line 256 characters
       
   107  	*/ 
       
   108 	#define PROFILE_DEBUG4( a, b, c ) { TSIPProfileDebug::Print( _L( a ), b , c ); }
       
   109 
       
   110  	/**
       
   111  	* Macro for logging a string and 3 integers
       
   112  	* PROFILE_DEBUG5("Hello", 1, 2, 3)
       
   113  	* Note, max length of printed line 256 characters
       
   114  	*/ 
       
   115 	#define PROFILE_DEBUG5( a, b, c, d ) { TSIPProfileDebug::Print( _L( a ), b , c, d ); }
       
   116 
       
   117  	/**
       
   118  	* Macro for logging a string and variable string
       
   119  	* PROFILE_DEBUG6("Hello", string)
       
   120  	* Note, max length of printed line 256 characters
       
   121  	*/ 
       
   122 	#define PROFILE_DEBUG6( a, b) { TSIPProfileDebug::Print( _L( a ), b ); }
       
   123 
       
   124 #else // _USE_SIP_PROFILE_LOGS
       
   125 	/**
       
   126  	* Macro for logging single string
       
   127  	* PROFILE_DEBUG1("Hello")
       
   128  	* Note, max length of printed line 256 characters
       
   129  	*/ 
       
   130 	#define PROFILE_DEBUG1( a )
       
   131 
       
   132 	/**
       
   133  	* Macro for logging two strings
       
   134  	* PROFILE_DEBUG2("Hello", "Back")
       
   135  	* Note, max length of printed line 256 characters
       
   136  	*/ 
       
   137 	#define PROFILE_DEBUG2( a, b )
       
   138 
       
   139 	/**
       
   140  	* Macro for logging a string and integer
       
   141  	* PROFILE_DEBUG3("Hello", 1)
       
   142  	* Note, max length of printed line 256 characters
       
   143  	*/ 
       
   144 	#define PROFILE_DEBUG3( a, b )
       
   145 
       
   146 	/**
       
   147  	* Macro for logging a string and 2 integers
       
   148  	* PROFILE_DEBUG4("Hello", 1, 2)
       
   149  	* Note, max length of printed line 256 characters
       
   150  	*/ 
       
   151 	#define PROFILE_DEBUG4( a, b, c )
       
   152 
       
   153 	/**
       
   154  	* Macro for logging a string and 3 integers
       
   155  	* PROFILE_DEBUG5("Hello", 1, 2, 3)
       
   156  	* Note, max length of printed line 256 characters
       
   157  	*/ 
       
   158 	#define PROFILE_DEBUG5( a, b, c, d )
       
   159 
       
   160  	/**
       
   161  	* Macro for logging a string and variable string
       
   162  	* PROFILE_DEBUG6("Hello", string)
       
   163  	* Note, max length of printed line 256 characters
       
   164  	*/ 
       
   165 	#define PROFILE_DEBUG6( a, b)
       
   166 
       
   167 #endif // USE_SIP_PROFILE_LOGS
       
   168 
       
   169 
       
   170 #endif // SIPPROFILELOG_H
       
   171 
       
   172 // End of File