diff -r 4096754ee773 -r 52a167391590 shortlinkconn_plat/obex_service_utils_api/tsrc/inc/testlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/inc/testlogger.h Wed Sep 01 12:20:40 2010 +0100 @@ -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 + +// 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 aLogText, ...) const; + TInt Log(const TDesC& aCategory, TRefByValue aLogText, ...) const; + TInt Log(TLogLevel aLevel, TRefByValue aLogText, ...) const; + TInt Log(const TDesC& aCategory, TRefByValue 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 +