sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: // InuLogger.h
sl@0: // 
sl@0: //
sl@0: 
sl@0: #ifndef __INULOGGER_H__
sl@0: #define __INULOGGER_H__
sl@0: 
sl@0: #include <e32std.h>
sl@0: #include <Flogger.h>
sl@0: 
sl@0: 
sl@0: // HTTP Logging class
sl@0: //##ModelId=3A914DF60214
sl@0: class TInuLogger
sl@0: 	{
sl@0: public: // methods
sl@0: 
sl@0: 	// Destructor - closes the log
sl@0: 	//##ModelId=3A914DF60249
sl@0: 	IMPORT_C ~TInuLogger();
sl@0: 
sl@0: 	// Create log file in directory KLogsdir\KWapLogsDirName - Note: ingore Drive and Path of aFilename
sl@0: 	//##ModelId=3A914DF6023F
sl@0: 	IMPORT_C void CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime);
sl@0: 
sl@0: 	//##ModelId=3A914DF6023C
sl@0: 	IMPORT_C void LogIt(TRefByValue<const TDesC> aFmt, ...);
sl@0: 
sl@0: 	// Writes aComment to test log file, logging file and test harness
sl@0: 	//##ModelId=3A914DF60232
sl@0: 	IMPORT_C void WriteComment(const TDesC& aComment);
sl@0: 
sl@0: 	// Do a formatted dump of binary data
sl@0: 	//##ModelId=3A914DF6022B
sl@0: 	IMPORT_C void DumpIt(const TDesC8& aData);
sl@0: 
sl@0: 	// Do a write of the supplied 8 bit data
sl@0: 	//##ModelId=3A914DF60234
sl@0: 	IMPORT_C void WriteComment(const TDesC8& aData);
sl@0: 
sl@0: private: // attributes
sl@0: 
sl@0: 	// Logger handle
sl@0: 	//##ModelId=3A914DF60228
sl@0: 	RFileLogger iLogger;
sl@0: 	};
sl@0: 
sl@0: // By default, logging will always be switched on.  Later, this may be removed, leaving it to individual
sl@0: // source files to enable logging where needed.
sl@0: #define _LOGGING
sl@0: 
sl@0: #if defined (_DEBUG) && defined (_LOGGING)
sl@0: 
sl@0: // HTTP Logging macros
sl@0: #define __DECLARE_LOG		TInuLogger iLogger;
sl@0: #define __OPEN_LOG(L)		iLogger.CreateFlogger(_L(L), ETrue, ETrue);
sl@0: #define __OPEN_LOG2(L)		iLogger.CreateFlogger(L, ETrue, ETrue);
sl@0: #define __LOG(C)			iLogger.WriteComment(C);
sl@0: #define __LOG1(C, X)		iLogger.LogIt(C, X);
sl@0: #define __LOG2(C, X, Y)		iLogger.LogIt(C, X, Y);
sl@0: #define __LOG3(C, X, Y, Z)	iLogger.LogIt(C, X, Y, Z);
sl@0: #define __DUMPBIN(D)		iLogger.DumpIt(D);
sl@0: #define __QINFO(aText)		{User::InfoPrint(aText); User::After(1000000);} 
sl@0: 
sl@0: #else if !defined (_DEBUG)
sl@0: 
sl@0: // NULL macros
sl@0: #define __DECLARE_LOG		
sl@0: #define __OPEN_LOG(L)		
sl@0: #define __OPEN_LOG2(L)		
sl@0: #define __LOG(C)			
sl@0: #define __LOG1(C, X)		
sl@0: #define __LOG2(C, X, Y)		
sl@0: #define __LOG3(C, X, Y, Z)	
sl@0: #define __DUMPBIN(D)		
sl@0: #define __QINFO(aText) 
sl@0: #endif // !_DEBUG
sl@0: 
sl@0: #endif // __InuLOGGER_H__