os/ossrv/genericservices/httputils/Test/IpuTestUtils/IpuLogger.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericservices/httputils/Test/IpuTestUtils/IpuLogger.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,92 @@
     1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// InuLogger.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __INULOGGER_H__
    1.22 +#define __INULOGGER_H__
    1.23 +
    1.24 +#include <e32std.h>
    1.25 +#include <Flogger.h>
    1.26 +
    1.27 +
    1.28 +// HTTP Logging class
    1.29 +//##ModelId=3A914DF60214
    1.30 +class TInuLogger
    1.31 +	{
    1.32 +public: // methods
    1.33 +
    1.34 +	// Destructor - closes the log
    1.35 +	//##ModelId=3A914DF60249
    1.36 +	IMPORT_C ~TInuLogger();
    1.37 +
    1.38 +	// Create log file in directory KLogsdir\KWapLogsDirName - Note: ingore Drive and Path of aFilename
    1.39 +	//##ModelId=3A914DF6023F
    1.40 +	IMPORT_C void CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime);
    1.41 +
    1.42 +	//##ModelId=3A914DF6023C
    1.43 +	IMPORT_C void LogIt(TRefByValue<const TDesC> aFmt, ...);
    1.44 +
    1.45 +	// Writes aComment to test log file, logging file and test harness
    1.46 +	//##ModelId=3A914DF60232
    1.47 +	IMPORT_C void WriteComment(const TDesC& aComment);
    1.48 +
    1.49 +	// Do a formatted dump of binary data
    1.50 +	//##ModelId=3A914DF6022B
    1.51 +	IMPORT_C void DumpIt(const TDesC8& aData);
    1.52 +
    1.53 +	// Do a write of the supplied 8 bit data
    1.54 +	//##ModelId=3A914DF60234
    1.55 +	IMPORT_C void WriteComment(const TDesC8& aData);
    1.56 +
    1.57 +private: // attributes
    1.58 +
    1.59 +	// Logger handle
    1.60 +	//##ModelId=3A914DF60228
    1.61 +	RFileLogger iLogger;
    1.62 +	};
    1.63 +
    1.64 +// By default, logging will always be switched on.  Later, this may be removed, leaving it to individual
    1.65 +// source files to enable logging where needed.
    1.66 +#define _LOGGING
    1.67 +
    1.68 +#if defined (_DEBUG) && defined (_LOGGING)
    1.69 +
    1.70 +// HTTP Logging macros
    1.71 +#define __DECLARE_LOG		TInuLogger iLogger;
    1.72 +#define __OPEN_LOG(L)		iLogger.CreateFlogger(_L(L), ETrue, ETrue);
    1.73 +#define __OPEN_LOG2(L)		iLogger.CreateFlogger(L, ETrue, ETrue);
    1.74 +#define __LOG(C)			iLogger.WriteComment(C);
    1.75 +#define __LOG1(C, X)		iLogger.LogIt(C, X);
    1.76 +#define __LOG2(C, X, Y)		iLogger.LogIt(C, X, Y);
    1.77 +#define __LOG3(C, X, Y, Z)	iLogger.LogIt(C, X, Y, Z);
    1.78 +#define __DUMPBIN(D)		iLogger.DumpIt(D);
    1.79 +#define __QINFO(aText)		{User::InfoPrint(aText); User::After(1000000);} 
    1.80 +
    1.81 +#else if !defined (_DEBUG)
    1.82 +
    1.83 +// NULL macros
    1.84 +#define __DECLARE_LOG		
    1.85 +#define __OPEN_LOG(L)		
    1.86 +#define __OPEN_LOG2(L)		
    1.87 +#define __LOG(C)			
    1.88 +#define __LOG1(C, X)		
    1.89 +#define __LOG2(C, X, Y)		
    1.90 +#define __LOG3(C, X, Y, Z)	
    1.91 +#define __DUMPBIN(D)		
    1.92 +#define __QINFO(aText) 
    1.93 +#endif // !_DEBUG
    1.94 +
    1.95 +#endif // __InuLOGGER_H__