|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 #ifndef DEBUG_H |
|
24 #define DEBUG_H |
|
25 |
|
26 |
|
27 #include <e32debug.h> |
|
28 |
|
29 //#define _USBMS_DEBUG_PRINT_ |
|
30 //#define _SCSI_DEBUG_PRINT_ |
|
31 //#define _BOT_DEBUG_PRINT_ |
|
32 //#define _CLIENT_DEBUG_PRINT_ |
|
33 //#define _TESTREPORT_PRINT_ |
|
34 #define _TESTMODE_PRINT_ |
|
35 |
|
36 #if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
37 #include <e32debug.h> |
|
38 #endif |
|
39 |
|
40 #if defined(_USBMS_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
41 #define __PRINT(t) {RDebug::Print(t);} |
|
42 #define __PRINT1(t,a) {RDebug::Print(t,a);} |
|
43 #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
44 #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} |
|
45 #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} |
|
46 #define __PRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} |
|
47 #define __PRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);} |
|
48 #define __PRINT1TEMP(t,a) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);} |
|
49 #define __PRINTERR(txt, err) {if(KErrNone != err) __PRINT1(txt, err);} |
|
50 |
|
51 _LIT(KMsgIn, ">>%S\n"); |
|
52 _LIT(KMsgOut,"<<%S\n"); |
|
53 |
|
54 class TMSLogFn |
|
55 { |
|
56 protected: |
|
57 TBuf<100> iName; |
|
58 |
|
59 public: |
|
60 TMSLogFn(const TDesC& aName){iName = aName; RDebug::Print(KMsgIn, &iName);}; |
|
61 ~TMSLogFn(){RDebug::Print(KMsgOut, &iName);}; |
|
62 }; |
|
63 |
|
64 #define __FNLOG(name) TMSLogFn __fn_log__(_L(name)) |
|
65 |
|
66 #else |
|
67 #define __PRINT(t) |
|
68 #define __PRINT1(t,a) |
|
69 #define __PRINT2(t,a,b) |
|
70 #define __PRINT3(t,a,b,c) |
|
71 #define __PRINT4(t,a,b,c,d) |
|
72 #define __PRINT5(t,a,b,c,d,e) |
|
73 #define __PRINT8BIT1(t,a) |
|
74 #define __PRINT1TEMP(t,a) |
|
75 #define __PRINTERR(txt,err) |
|
76 #define __FNLOG(name) |
|
77 #endif |
|
78 |
|
79 |
|
80 #if defined(_SCSI_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
81 #define __SCSIPRINT(t) {RDebug::Print(t);} |
|
82 #define __SCSIPRINT1(t,a) {RDebug::Print(t,a);} |
|
83 #define __SCSIPRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
84 #define __SCSIPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} |
|
85 #define __SCSIPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} |
|
86 #define __SCSIPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} |
|
87 #else |
|
88 #define __SCSIPRINT(t) |
|
89 #define __SCSIPRINT1(t,a) |
|
90 #define __SCSIPRINT2(t,a,b) |
|
91 #define __SCSIPRINT3(t,a,b,c) |
|
92 #define __SCSIPRINT4(t,a,b,c,d) |
|
93 #define __SCSIPRINT5(t,a,b,c,d,e) |
|
94 #endif |
|
95 |
|
96 |
|
97 #if defined(_BOT_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
98 #define __BOTPRINT(t) {RDebug::Print(t);} |
|
99 #define __BOTPRINT1(t,a) {RDebug::Print(t,a);} |
|
100 #define __BOTPRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
101 #define __BOTPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} |
|
102 #define __BOTPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} |
|
103 #define __BOTPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} |
|
104 #else |
|
105 #define __BOTPRINT(t) |
|
106 #define __BOTPRINT1(t,a) |
|
107 #define __BOTPRINT2(t,a,b) |
|
108 #define __BOTPRINT3(t,a,b,c) |
|
109 #define __BOTPRINT4(t,a,b,c,d) |
|
110 #define __BOTPRINT5(t,a,b,c,d,e) |
|
111 #endif |
|
112 |
|
113 |
|
114 #if defined(_CLIENT_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
115 #define __CLIENTPRINT(t) {RDebug::Print(t);} |
|
116 #define __CLIENTPRINT1(t,a) {RDebug::Print(t,a);} |
|
117 #define __CLIENTPRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
118 #define __CLIENTPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} |
|
119 #define __CLIENTPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} |
|
120 #define __CLIENTPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} |
|
121 #else |
|
122 #define __CLIENTPRINT(t) |
|
123 #define __CLIENTPRINT1(t,a) |
|
124 #define __CLIENTPRINT2(t,a,b) |
|
125 #define __CLIENTPRINT3(t,a,b,c) |
|
126 #define __CLIENTPRINT4(t,a,b,c,d) |
|
127 #define __CLIENTPRINT5(t,a,b,c,d,e) |
|
128 #endif |
|
129 |
|
130 |
|
131 #if defined(_TESTREPORT_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
132 #define __TESTREPORT(t) {RDebug::Print(t);} |
|
133 #define __TESTREPORT1(t,a) {RDebug::Print(t,a);} |
|
134 #define __TESTREPORT2(t,a,b) {RDebug::Print(t,a,b);} |
|
135 #define __TESTREPORT3(t,a,b,c) {RDebug::Print(t,a,b,c);} |
|
136 #define __TESTREPORT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} |
|
137 #define __TESTREPORT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} |
|
138 #else |
|
139 #define __TESTREPORT(t) |
|
140 #define __TESTREPORT1(t,a) |
|
141 #define __TESTREPORT2(t,a,b) |
|
142 #define __TESTREPORT3(t,a,b,c) |
|
143 #define __TESTREPORT4(t,a,b,c,d) |
|
144 #define __TESTREPORT5(t,a,b,c,d,e) |
|
145 #endif |
|
146 |
|
147 |
|
148 #if defined(_TESTMODE_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
149 #define PREFIX(aMsg) TPtrC( (const TText*)L"[TM]: " L##aMsg ) |
|
150 |
|
151 #define __TESTMODEPRINT(t) {RDebug::Print(PREFIX(t));} |
|
152 #define __TESTMODEPRINT1(t,a) {RDebug::Print(PREFIX(t),a);} |
|
153 #define __TESTMODEPRINT2(t,a,b) {RDebug::Print(PREFIX(t),a,b);} |
|
154 #define __TESTMODEPRINT3(t,a,b,c) {RDebug::Print(PREFIX(t),a,b,c);} |
|
155 #define __TESTMODEPRINT4(t,a,b,c,d) {RDebug::Print(PREFIX(t),a,b,c,d);} |
|
156 #define __TESTMODEPRINT5(t,a,b,c,d,e) {RDebug::Print(PREFIX(t),a,b,c,d,e);} |
|
157 #else |
|
158 #define __TESTMODEPRINT(t) |
|
159 #define __TESTMODEPRINT1(t,a) |
|
160 #define __TESTMODEPRINT2(t,a,b) |
|
161 #define __TESTMODEPRINT3(t,a,b,c) |
|
162 #define __TESTMODEPRINT4(t,a,b,c,d) |
|
163 #define __TESTMODEPRINT5(t,a,b,c,d,e) |
|
164 #endif |
|
165 |
|
166 #endif // DEBUG_H |