diff -r 25fce757be94 -r e02eb84a14d2 usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.h Wed Sep 01 12:20:49 2010 +0100 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2010 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 TESTDEBUG_H_ +#define TESTDEBUG_H_ + +// INCLUDES +#include +#include + +// CONSTANTS +_LIT8(KStifTestPrefix8, "[STIF_LOG] "); +_LIT( KStifTestPrefix, "[STIF_LOG] "); +_LIT8( KStifEntryPrefix8, ">>> %S" ); +_LIT8( KStifExitPrefix8, "<<< %S" ); + +const TInt KMaxLogLineLength = 512; +typedef TBuf8< KMaxLogLineLength > TLogBuf8; +typedef TBuf16< KMaxLogLineLength > TLogBuf16; + +// CLASS DECLARATION +NONSHARABLE_CLASS( TTestLogger ) + { +public: + static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); + static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); + static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ); + }; + +// MACROS +#define TRACE( p ) {\ + TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\ + TTestLogger::Trace( *iLog, buf );\ + } +#define TRACE_INFO( p, args... ) {\ + TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\ + TTestLogger::Trace( *iLog, buf );\ + } +#define TRACE_FUNC_ENTRY {\ + TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ + TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\ + TTestLogger::Trace( *iLog, buf );\ + } +#define TRACE_FUNC_EXIT {\ + TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ + TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\ + TTestLogger::Trace( *iLog, buf );\ + } + +#include "testdebug.inl" + +#endif /* TESTDEBUG_H_ */