os/ossrv/genericservices/httputils/Test/IpuTestUtils/IpuLogger.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// InuLogger.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __INULOGGER_H__
sl@0
    19
#define __INULOGGER_H__
sl@0
    20
sl@0
    21
#include <e32std.h>
sl@0
    22
#include <Flogger.h>
sl@0
    23
sl@0
    24
sl@0
    25
// HTTP Logging class
sl@0
    26
//##ModelId=3A914DF60214
sl@0
    27
class TInuLogger
sl@0
    28
	{
sl@0
    29
public: // methods
sl@0
    30
sl@0
    31
	// Destructor - closes the log
sl@0
    32
	//##ModelId=3A914DF60249
sl@0
    33
	IMPORT_C ~TInuLogger();
sl@0
    34
sl@0
    35
	// Create log file in directory KLogsdir\KWapLogsDirName - Note: ingore Drive and Path of aFilename
sl@0
    36
	//##ModelId=3A914DF6023F
sl@0
    37
	IMPORT_C void CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime);
sl@0
    38
sl@0
    39
	//##ModelId=3A914DF6023C
sl@0
    40
	IMPORT_C void LogIt(TRefByValue<const TDesC> aFmt, ...);
sl@0
    41
sl@0
    42
	// Writes aComment to test log file, logging file and test harness
sl@0
    43
	//##ModelId=3A914DF60232
sl@0
    44
	IMPORT_C void WriteComment(const TDesC& aComment);
sl@0
    45
sl@0
    46
	// Do a formatted dump of binary data
sl@0
    47
	//##ModelId=3A914DF6022B
sl@0
    48
	IMPORT_C void DumpIt(const TDesC8& aData);
sl@0
    49
sl@0
    50
	// Do a write of the supplied 8 bit data
sl@0
    51
	//##ModelId=3A914DF60234
sl@0
    52
	IMPORT_C void WriteComment(const TDesC8& aData);
sl@0
    53
sl@0
    54
private: // attributes
sl@0
    55
sl@0
    56
	// Logger handle
sl@0
    57
	//##ModelId=3A914DF60228
sl@0
    58
	RFileLogger iLogger;
sl@0
    59
	};
sl@0
    60
sl@0
    61
// By default, logging will always be switched on.  Later, this may be removed, leaving it to individual
sl@0
    62
// source files to enable logging where needed.
sl@0
    63
#define _LOGGING
sl@0
    64
sl@0
    65
#if defined (_DEBUG) && defined (_LOGGING)
sl@0
    66
sl@0
    67
// HTTP Logging macros
sl@0
    68
#define __DECLARE_LOG		TInuLogger iLogger;
sl@0
    69
#define __OPEN_LOG(L)		iLogger.CreateFlogger(_L(L), ETrue, ETrue);
sl@0
    70
#define __OPEN_LOG2(L)		iLogger.CreateFlogger(L, ETrue, ETrue);
sl@0
    71
#define __LOG(C)			iLogger.WriteComment(C);
sl@0
    72
#define __LOG1(C, X)		iLogger.LogIt(C, X);
sl@0
    73
#define __LOG2(C, X, Y)		iLogger.LogIt(C, X, Y);
sl@0
    74
#define __LOG3(C, X, Y, Z)	iLogger.LogIt(C, X, Y, Z);
sl@0
    75
#define __DUMPBIN(D)		iLogger.DumpIt(D);
sl@0
    76
#define __QINFO(aText)		{User::InfoPrint(aText); User::After(1000000);} 
sl@0
    77
sl@0
    78
#else if !defined (_DEBUG)
sl@0
    79
sl@0
    80
// NULL macros
sl@0
    81
#define __DECLARE_LOG		
sl@0
    82
#define __OPEN_LOG(L)		
sl@0
    83
#define __OPEN_LOG2(L)		
sl@0
    84
#define __LOG(C)			
sl@0
    85
#define __LOG1(C, X)		
sl@0
    86
#define __LOG2(C, X, Y)		
sl@0
    87
#define __LOG3(C, X, Y, Z)	
sl@0
    88
#define __DUMPBIN(D)		
sl@0
    89
#define __QINFO(aText) 
sl@0
    90
#endif // !_DEBUG
sl@0
    91
sl@0
    92
#endif // __InuLOGGER_H__