|
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: Tracing macros |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef LOGGER_H |
|
19 #define LOGGER_H |
|
20 |
|
21 #ifndef _DEBUG |
|
22 |
|
23 #define TRACE( AA ) |
|
24 |
|
25 #define TRACE2( AA, BB ) |
|
26 |
|
27 #define TRACE3( AA, BB, CC ) |
|
28 |
|
29 #define TRACE4( AA, BB, CC, DD ) |
|
30 |
|
31 #define TRACE5( AA, BB, CC, DD, EE ) |
|
32 |
|
33 #define DUMP8( AA ) |
|
34 |
|
35 #define TRACE_DOWNLOADER_STATE( AA ) |
|
36 |
|
37 #define TRACE_AND_PANIC( AA ) |
|
38 |
|
39 #define PANIC_ON_ERROR(AA, BB) |
|
40 |
|
41 #else |
|
42 |
|
43 // INCLUDES |
|
44 #include <e32debug.h> |
|
45 |
|
46 #define TRACE_AND_PANIC( AA ) \ |
|
47 { \ |
|
48 RDebug::Printf( "ERROR: " AA ); \ |
|
49 ASSERT(EFalse); \ |
|
50 } |
|
51 |
|
52 #define PANIC_ON_ERROR(AA, BB) \ |
|
53 { \ |
|
54 if(AA) \ |
|
55 { \ |
|
56 RDebug::Printf( "ERROR: " BB, AA ); \ |
|
57 ASSERT(EFalse); \ |
|
58 } \ |
|
59 } |
|
60 |
|
61 #define TRACE( AA ) do { RDebug::Printf( AA ); } while( 0 ) |
|
62 |
|
63 #define TRACE2( AA, BB ) do { RDebug::Printf( AA, BB ); } while( 0 ) |
|
64 |
|
65 #define TRACE3( AA, BB, CC ) do { RDebug::Printf( AA, BB, CC ); } while( 0 ) |
|
66 |
|
67 #define TRACE4( AA, BB, CC, DD ) do { RDebug::Printf( AA, BB, CC, DD ); } while( 0 ) |
|
68 |
|
69 #define TRACE5( AA, BB, CC, DD, EE ) do { RDebug::Printf( AA, BB, CC, DD, EE ); } while( 0 ) |
|
70 |
|
71 #define DUMP8( AA ) \ |
|
72 TRAP_IGNORE( \ |
|
73 { \ |
|
74 HBufC* conversion = HBufC::NewLC( AA.Length() ); \ |
|
75 TPtr convPtr( conversion->Des() ); \ |
|
76 convPtr.Copy( AA ); \ |
|
77 const TInt KMaxLine = 60; \ |
|
78 for ( TInt index = convPtr.Length(); index > 0; \ |
|
79 index -= KMaxLine ) \ |
|
80 { \ |
|
81 if ( index <= KMaxLine ) \ |
|
82 { \ |
|
83 RDebug::Print( convPtr ); \ |
|
84 break; \ |
|
85 } \ |
|
86 else \ |
|
87 { \ |
|
88 RDebug::Print( convPtr.Left( KMaxLine ) ); \ |
|
89 convPtr.Copy( convPtr.Mid( KMaxLine ) ); \ |
|
90 } \ |
|
91 } \ |
|
92 CleanupStack::PopAndDestroy( conversion ); \ |
|
93 } ); |
|
94 |
|
95 |
|
96 #endif // _LOGGER |
|
97 |
|
98 #endif // _LOGGER |
|
99 |
|
100 // End of File |