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