|
1 // Copyright (c) 2008-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 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef DEBUG_H |
|
22 #define DEBUG_H |
|
23 |
|
24 #if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
25 #include <e32debug.h> |
|
26 #endif |
|
27 |
|
28 // #define _USBMS_DEBUG_PRINT_ |
|
29 |
|
30 #if defined(_USBMS_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
31 /** Trace - format string */ |
|
32 #define __PRINT(t) {RDebug::Print(t);} |
|
33 /** Trace - format string with 1 param */ |
|
34 #define __PRINT1(t,a) {RDebug::Print(t,a);} |
|
35 /** Trace - format string with 2 params */ |
|
36 #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
37 /** Trace - format string with 3 params */ |
|
38 #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} |
|
39 /** Trace - format string with 4 params */ |
|
40 #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} |
|
41 /** Trace - format string with 5 params */ |
|
42 #define __PRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} |
|
43 |
|
44 |
|
45 _LIT(KMsgIn, ">>%S\n"); |
|
46 _LIT(KMsgOut,"<<%S\n"); |
|
47 |
|
48 class TMSLogFn |
|
49 { |
|
50 protected: |
|
51 TBuf<100> iName; |
|
52 |
|
53 public: |
|
54 TMSLogFn(const TDesC& aName){iName = aName; RDebug::Print(KMsgIn, &iName);}; |
|
55 ~TMSLogFn(){RDebug::Print(KMsgOut, &iName);}; |
|
56 }; |
|
57 |
|
58 #define __FNLOG(name) TMSLogFn __fn_log__(_L(name)) |
|
59 |
|
60 #else |
|
61 |
|
62 /** NULL definition */ |
|
63 #define __PRINT(t) |
|
64 /** NULL definition */ |
|
65 #define __PRINT1(t,a) |
|
66 /** NULL definition */ |
|
67 #define __PRINT2(t,a,b) |
|
68 /** NULL definition */ |
|
69 #define __PRINT3(t,a,b,c) |
|
70 /** NULL definition */ |
|
71 #define __PRINT4(t,a,b,c,d) |
|
72 /** NULL definition */ |
|
73 #define __PRINT5(t,a,b,c,d,e) |
|
74 /** NULL definition */ |
|
75 #define __FNLOG(name) |
|
76 #endif |
|
77 |
|
78 #endif // DEBUG_H |