|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TESTDEBUG_H_ |
|
19 #define TESTDEBUG_H_ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32debug.h> |
|
23 #include <e32def.h> |
|
24 |
|
25 // CONSTANTS |
|
26 _LIT8(KStifTestPrefix8, "[STIF_LOG] "); |
|
27 _LIT( KStifTestPrefix, "[STIF_LOG] "); |
|
28 _LIT8( KStifEntryPrefix8, ">>> %S" ); |
|
29 _LIT8( KStifExitPrefix8, "<<< %S" ); |
|
30 |
|
31 const TInt KMaxLogLineLength = 512; |
|
32 typedef TBuf8< KMaxLogLineLength > TLogBuf8; |
|
33 typedef TBuf16< KMaxLogLineLength > TLogBuf16; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 NONSHARABLE_CLASS( TTestLogger ) |
|
37 { |
|
38 public: |
|
39 static inline TLogBuf16 CreateLogBuf( TRefByValue<const TDesC8> aFmt, ... ); |
|
40 static inline TLogBuf16 CreateLogBuf( TRefByValue<const TDesC16> aFmt, ... ); |
|
41 static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ); |
|
42 }; |
|
43 |
|
44 // MACROS |
|
45 #define TRACE( p ) {\ |
|
46 TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\ |
|
47 TTestLogger::Trace( *iLog, buf );\ |
|
48 } |
|
49 #define TRACE_INFO( p, args... ) {\ |
|
50 TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\ |
|
51 TTestLogger::Trace( *iLog, buf );\ |
|
52 } |
|
53 #define TRACE_FUNC_ENTRY {\ |
|
54 TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ |
|
55 TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\ |
|
56 TTestLogger::Trace( *iLog, buf );\ |
|
57 } |
|
58 #define TRACE_FUNC_EXIT {\ |
|
59 TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ |
|
60 TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\ |
|
61 TTestLogger::Trace( *iLog, buf );\ |
|
62 } |
|
63 |
|
64 #include "testdebug.inl" |
|
65 |
|
66 #endif /* TESTDEBUG_H_ */ |