btservices_plat/obex_service_utils_api/tsrc/inc/testlogger.h
branchRCL_3
changeset 55 613943a21004
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/btservices_plat/obex_service_utils_api/tsrc/inc/testlogger.h	Tue Aug 31 15:25:10 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef BTTESTLOGGER_H
+#define BTTESTLOGGER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CStifLogger;
+class CTestModuleIf;
+
+#define TLFUNCLOG (TUint8*) __FUNCTION__
+
+// CLASS DECLARATION
+
+NONSHARABLE_CLASS( CObexTestLogger ) : public CBase
+{
+	public:
+	
+		static CObexTestLogger* NewL(const CTestModuleIf* aTestModuleIf);
+		virtual ~CObexTestLogger();
+
+	public: // Data used by functions
+
+		enum TLogLevel {ETLError, ETLResult, ETLInfo, ETLDebug};
+
+	public: // New functions
+	
+		TBool GetEnabled() const;
+		CStifLogger* GetLogger() const;
+		const CTestModuleIf* GetTestModuleIf() const;
+		TInt Log(TLogLevel aLevel, TRefByValue<const TDesC8> aLogText, ...) const;
+		TInt Log(const TDesC& aCategory, TRefByValue<const TDesC8> aLogText, ...) const;
+		TInt Log(TLogLevel aLevel, TRefByValue<const TDesC16> aLogText, ...) const;
+		TInt Log(const TDesC& aCategory, TRefByValue<const TDesC16> aLogText, ...) const;
+		TInt LogResult( const TDesC8& aFunc, const TDesC& aArg, TInt aRes ) const;
+		TInt LogNewLine() const;
+		void SetEnabled(TBool aEnabled);
+		void SetLogger(CStifLogger* aLog);
+		void SetTestModuleIf(const CTestModuleIf* aTestModuleIf);
+
+	public: // Functions from base classes
+
+	private:  // New functions
+
+		TInt WriteLog(TLogLevel aLevel, TDes16& aLog) const;
+		TInt WriteLog(const TDesC16& aCategory, const TDesC16& aLog) const;
+		static TPtrC GetPrefix(TLogLevel aLevel);
+		TInt CheckLogFile();
+		void LogHeadSectionL();
+		void LogTimeStampL(TDes& aBuf, TBool aTime = ETrue) const;
+
+	private:  // Constructors
+	
+		CObexTestLogger(const CTestModuleIf* aTestModuleIf);
+		void ConstructL();
+
+	public:     // Data
+		static const TInt KPrefixLength;
+
+	private:    // Data
+
+		TBool iEnabled;
+		CStifLogger* iLog;
+		const CTestModuleIf* iTestModuleIf;
+	};
+
+#endif // BTTESTLOGGER_H
+