applayerprotocols/httptransportfw/inc/framework/httplogger.h
changeset 0 b16258d2340f
child 18 f21293830889
child 30 b7f26243ec94
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2001-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 //
       
    15 
       
    16 /**
       
    17  @file httplogger.h
       
    18  @warning : This file contains Rose Model ID comments - please do not delete
       
    19  @publishedPartner
       
    20  @released
       
    21 */
       
    22 
       
    23 #ifndef __HTTPLOGGER_H__
       
    24 #define __HTTPLOGGER_H__
       
    25 
       
    26 // System includes
       
    27 #include <e32std.h>
       
    28 #include <flogger.h>
       
    29 
       
    30 
       
    31 //##ModelId=3C4C4C3E0139
       
    32 class THttpLogger : public TDesOverflow
       
    33 /** 
       
    34 A utility used in HTTP for logging in debug builds.  Log files are placed in the
       
    35 directory %EPOCROOT%/epoc32/wins/c/logs/http
       
    36 @publishedPartner
       
    37 @released
       
    38 */
       
    39 	{
       
    40 public: // methods
       
    41 
       
    42 	/** Destructor - closes the log
       
    43 	##ModelId=3C4C4C3E0180
       
    44 	*/
       
    45 	IMPORT_C virtual ~THttpLogger();
       
    46 
       
    47 	/** Create log file in directory KLogsdir\KWapLogsDirName - Note: ignore Drive and Path of aFilename
       
    48 	@param aFileName Log file name.
       
    49 	@param aShowDate Report date in log.
       
    50 	@param aShowTime Report time in log.
       
    51 	##ModelId=3C4C4C3E0175
       
    52 	*/
       
    53 	IMPORT_C void CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime);
       
    54 
       
    55 	/** Logs a list of values formatted by a format string.
       
    56 	@param aFmt Format string
       
    57 	##ModelId=3C4C4C3E0162
       
    58 	*/
       
    59 	IMPORT_C void LogIt(TRefByValue<const TDesC> aFmt, ...);
       
    60 	              
       
    61 	/** Writes aComment to test log file, logging file and test harness.
       
    62 	@param aComment String to log
       
    63 	##ModelId=3C4C4C3E0158
       
    64 	*/
       
    65 	IMPORT_C void WriteComment(const TDesC& aComment);
       
    66 
       
    67 	/** Do a formatted dump of binary data.
       
    68 	@param aData Data to log.
       
    69 	##ModelId=3C4C4C3E0150
       
    70 	*/
       
    71 	IMPORT_C void DumpIt(const TDesC8& aData);
       
    72 
       
    73 	/** Do a write of the supplied 8 bit data.
       
    74 	@param aData String to log
       
    75 	##ModelId=3C4C4C3E015A
       
    76 	*/
       
    77 	IMPORT_C void WriteComment(const TDesC8& aData);
       
    78 
       
    79 private:
       
    80 	
       
    81 	/** Methods from TDesOverflow
       
    82 	@param aDes modifiable descriptor whose overflow results in the call to this overflow handler.
       
    83 	*/
       
    84 	IMPORT_C virtual void Overflow(TDes& aDes);
       
    85 
       
    86 private: // attributes
       
    87 
       
    88 	// Logger handle
       
    89 	//##ModelId=3C4C4C3E014D
       
    90 	RFileLogger* iLogger;
       
    91 	};
       
    92 
       
    93 // By default, logging will always be switched on.  Later, this may be removed, leaving it to individual
       
    94 // source files to enable logging where needed.
       
    95 #define _LOGGING
       
    96 
       
    97 #if defined (_DEBUG) && defined (_LOGGING)
       
    98 
       
    99 // HTTP Logging macros
       
   100 #define __DECLARE_LOG		THttpLogger iLogger;
       
   101 #define __OPEN_LOG(L)		iLogger.CreateFlogger(_L(L), ETrue, ETrue);
       
   102 #define __OPEN_LOG2(L)		iLogger.CreateFlogger(L, ETrue, ETrue);
       
   103 #define __LOG(C)			iLogger.WriteComment(C);
       
   104 #define __LOG1(C, X)		iLogger.LogIt(C, X);
       
   105 #define __LOG2(C, X, Y)		iLogger.LogIt(C, X, Y);
       
   106 #define __LOG3(C, X, Y, Z)	iLogger.LogIt(C, X, Y, Z);
       
   107 #define __DUMPBIN(D)		iLogger.DumpIt(D);
       
   108 #define __QINFO(aText)		{User::InfoPrint(aText); User::After(1000000);} 
       
   109 
       
   110 #else if !defined (_DEBUG)
       
   111 
       
   112 // NULL macros
       
   113 #define __DECLARE_LOG		TUint8 iDummyLoggerNotUsed[sizeof(THttpLogger)];
       
   114 #define __OPEN_LOG(L)		
       
   115 #define __OPEN_LOG2(L)		
       
   116 #define __LOG(C)			
       
   117 #define __LOG1(C, X)		
       
   118 #define __LOG2(C, X, Y)		
       
   119 #define __LOG3(C, X, Y, Z)	
       
   120 #define __DUMPBIN(D)		
       
   121 #define __QINFO(aText) 
       
   122 #endif // !_DEBUG
       
   123 
       
   124 #endif // __HTTPLOGGER_H__