serialserver/c32serialserver/INC/C32LOG.H
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Logging macros for C32. These use the Comms Debug (Flogger V2) Utility.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 
       
    24 #ifndef C32LOG_H
       
    25 #define C32LOG_H
       
    26 
       
    27 #include <comms-infras/commsdebugutility.h>
       
    28 
       
    29 #if (defined __FLOG_ACTIVE)
       
    30 
       
    31 #include <c32comm.h>
       
    32 #include <cs_port.h>
       
    33 #include "COMMIPC.H"
       
    34 
       
    35 class TC32Log
       
    36 /**
       
    37 @internalComponent
       
    38 */
       
    39 	{
       
    40 public:
       
    41  	IMPORT_C static void Printf(TBool aStatic, const TDesC8& aSubTag, TRefByValue<const TDesC> aFmt, ...);
       
    42  	IMPORT_C static void Printf(TBool aStatic, const TDesC8& aSubTag, TRefByValue<const TDesC8> aFmt, ...);
       
    43    	static void Printf(TBool aStatic, const TDesC8& aSubTag, TRefByValue<const TDesC> aFmt, VA_LIST& aList);
       
    44    	static void Printf(TBool aStatic, const TDesC8& aSubTag, TRefByValue<const TDesC8> aFmt, VA_LIST& aList);
       
    45 	static const TDesC8& CommRoleStr(TCommRole aRole);
       
    46 	static const TDesC8& CommAccessStr(const TCommAccess& aMode);
       
    47 	static const TDesC& CommRoleStr16(TCommRole aRole);
       
    48 	static const TDesC& CommAccessStr16(const TCommAccess& aMode);
       
    49 	static const TDesC8& InternalCommAccessStr(TInternalCommAccess aMode);
       
    50 	static const TDesC8& C32RequestStr(TInt aIPC);
       
    51 	};
       
    52 	
       
    53 	
       
    54 	
       
    55 
       
    56 class TLogIgnoreOverflow8 : public TDes8Overflow
       
    57 	{
       
    58 public:
       
    59 	void Overflow(TDes8& /*aDes*/) { }
       
    60 	};
       
    61 
       
    62 class TLogIgnoreOverflow16 : public TDes16Overflow
       
    63 	{
       
    64 public:
       
    65 	void Overflow(TDes16& /*aDes*/) { }
       
    66 	};
       
    67 	
       
    68 	
       
    69 
       
    70 /** Rootserver module tag, used for leak output logging
       
    71 */
       
    72 _LIT8(KRSModule, "rsmodule");
       
    73 
       
    74 /** Rootserver module leak logging tag
       
    75 */
       
    76 _LIT8(KRSModuleLeak, "leak");
       
    77 
       
    78 
       
    79 _LIT8(KC32SubSystem,   "C32SerComms");
       
    80 _LIT8(KC32Bootup,      "Bootup");
       
    81 _LIT8(KC32Shutdown,    "Shutdown");
       
    82 _LIT8(KC32Warning,     "Warning");
       
    83 _LIT8(KC32Client,      "Client");
       
    84 _LIT8(KC32Dealer,	   "Dealer");
       
    85 _LIT8(KC32Player,      "Player");
       
    86 _LIT8(KC32CommsTrspMsg,"Transport");
       
    87 _LIT8(KC32Detail,      "Detail");
       
    88 
       
    89 
       
    90 #define C32LOG(Level,A)                 		TC32Log::Printf(EFalse, Level,A)
       
    91 #define C32_STATIC_LOG(Level,A)                 TC32Log::Printf(ETrue, Level,A)
       
    92 
       
    93 
       
    94 #define C32LOG1(Level,A)                		TC32Log::Printf(EFalse, Level,A)
       
    95 #define C32LOG2(Level,A,B)              		TC32Log::Printf(EFalse, Level,A,B)
       
    96 #define C32LOG3(Level,A,B,C)            		TC32Log::Printf(EFalse, Level,A,B,C)
       
    97 #define C32LOG4(Level,A,B,C,D)          		TC32Log::Printf(EFalse, Level,A,B,C,D)
       
    98 #define C32LOG5(Level,A,B,C,D,E)        		TC32Log::Printf(EFalse, Level,A,B,C,D,E)
       
    99 #define C32LOG6(Level,A,B,C,D,E,F)      		TC32Log::Printf(EFalse, Level,A,B,C,D,E,F)
       
   100 #define C32LOG7(Level,A,B,C,D,E,F,G)    		TC32Log::Printf(EFalse, Level,A,B,C,D,E,F,G)
       
   101 #define C32LOG8(Level,A,B,C,D,E,F,G,H)  		TC32Log::Printf(EFalse, Level,A,B,C,D,E,F,G,H)
       
   102 
       
   103 #define C32_STATIC_LOG1(Level,A)                TC32Log::Printf(ETrue, Level,A)
       
   104 #define C32_STATIC_LOG2(Level,A,B)              TC32Log::Printf(ETrue, Level,A,B)
       
   105 #define C32_STATIC_LOG3(Level,A,B,C)            TC32Log::Printf(ETrue, Level,A,B,C)
       
   106 #define C32_STATIC_LOG4(Level,A,B,C,D)          TC32Log::Printf(ETrue, Level,A,B,C,D)
       
   107 #define C32_STATIC_LOG5(Level,A,B,C,D,E)        TC32Log::Printf(ETrue, Level,A,B,C,D,E)
       
   108 #define C32_STATIC_LOG6(Level,A,B,C,D,E,F)      TC32Log::Printf(ETrue, Level,A,B,C,D,E,F)
       
   109 #define C32_STATIC_LOG7(Level,A,B,C,D,E,F,G)    TC32Log::Printf(ETrue, Level,A,B,C,D,E,F,G)
       
   110 #define C32_STATIC_LOG8(Level,A,B,C,D,E,F,G,H)  TC32Log::Printf(ETrue, Level,A,B,C,D,E,F,G,H)
       
   111 
       
   112 // C32LOGVA allows multi-param logging without having to specify number; useful if num params changed
       
   113 // often during coding. To use, enclose the whole thing in a second set of brackets, eg:
       
   114 // C32LOGVA((_L8("Params: %d %d %d"),param1,param2,param3));
       
   115 #define C32LOGVA(args)                   args
       
   116 
       
   117 
       
   118 
       
   119 
       
   120 
       
   121 #else  // __FLOG_ACTIVE
       
   122 
       
   123 #define KC32Warning KNullDesC8
       
   124 #define KC32Detail  KNullDesC8
       
   125 #define KC32Bootup  KNullDesC8
       
   126 
       
   127 #define C32LOG(Level,A)
       
   128 #define C32LOG1(Level,A)               
       
   129 #define C32LOG2(Level,A,B)             
       
   130 #define C32LOG3(Level,A,B,C)           
       
   131 #define C32LOG4(Level,A,B,C,D)         
       
   132 #define C32LOG5(Level,A,B,C,D,E)       
       
   133 #define C32LOG6(Level,A,B,C,D,E,F)     
       
   134 #define C32LOG7(Level,A,B,C,D,E,F,G)   
       
   135 #define C32LOG8(Level,A,B,C,D,E,F,G,H) 
       
   136 #define C32LOGVA(args)                 
       
   137 
       
   138 #define C32_STATIC_LOG(Level,A) 
       
   139 #define C32_STATIC_LOG1(Level,A)                
       
   140 #define C32_STATIC_LOG2(Level,A,B)              
       
   141 #define C32_STATIC_LOG3(Level,A,B,C)            
       
   142 #define C32_STATIC_LOG4(Level,A,B,C,D)          
       
   143 #define C32_STATIC_LOG5(Level,A,B,C,D,E)        
       
   144 #define C32_STATIC_LOG6(Level,A,B,C,D,E,F)      
       
   145 #define C32_STATIC_LOG7(Level,A,B,C,D,E,F,G)    
       
   146 #define C32_STATIC_LOG8(Level,A,B,C,D,E,F,G,H)  
       
   147 
       
   148 class TC32Log
       
   149 /**
       
   150 @internalComponent
       
   151 */
       
   152  	{
       
   153 public:
       
   154  	IMPORT_C static void Printf(TBool /* aStatic */, const TDesC8& /* aSubTag */, TRefByValue<const TDesC> /* aFmt */, ...);
       
   155  	IMPORT_C static void Printf(TBool /* aStatic */, const TDesC8& /* aSubTag */, TRefByValue<const TDesC8> /* aFmt */, ...);
       
   156  	};
       
   157 
       
   158 #endif	//__FLOG_ACTIVE
       
   159 
       
   160 #endif  // C32LOG_H