1 // Copyright (c) 2008-2010 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 // #define _MSDEVICE_DEBUG_PRINT_ |
|
30 |
|
31 #if defined(_USBMS_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
32 /** Trace - format string */ |
|
33 #define __PRINT(t) {RDebug::Print(t);} |
|
34 /** Trace - format string with 1 param */ |
|
35 #define __PRINT1(t,a) {RDebug::Print(t,a);} |
|
36 /** Trace - format string with 2 params */ |
|
37 #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
38 /** Trace - format string with 3 params */ |
|
39 #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} |
|
40 /** Trace - format string with 4 params */ |
|
41 #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} |
|
42 /** Trace - format string with 5 params */ |
|
43 #define __PRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} |
|
44 |
|
45 |
|
46 _LIT(KMsgIn, ">>%S\n"); |
|
47 _LIT(KMsgOut,"<<%S\n"); |
|
48 |
|
49 class TMSLogFn |
|
50 { |
|
51 protected: |
|
52 TBuf<100> iName; |
|
53 |
|
54 public: |
|
55 TMSLogFn(const TDesC& aName){iName = aName; RDebug::Print(KMsgIn, &iName);}; |
|
56 ~TMSLogFn(){RDebug::Print(KMsgOut, &iName);}; |
|
57 }; |
|
58 |
|
59 #define __FNLOG(name) TMSLogFn __fn_log__(_L(name)) |
|
60 |
|
61 #else |
|
62 |
|
63 /** NULL definition */ |
|
64 #define __PRINT(t) |
|
65 /** NULL definition */ |
|
66 #define __PRINT1(t,a) |
|
67 /** NULL definition */ |
|
68 #define __PRINT2(t,a,b) |
|
69 /** NULL definition */ |
|
70 #define __PRINT3(t,a,b,c) |
|
71 /** NULL definition */ |
|
72 #define __PRINT4(t,a,b,c,d) |
|
73 /** NULL definition */ |
|
74 #define __PRINT5(t,a,b,c,d,e) |
|
75 /** NULL definition */ |
|
76 #define __FNLOG(name) |
|
77 #endif |
|
78 |
|
79 |
|
80 #if defined (_MSDEVICE_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
81 #define __MSDEVPRINT(t) {RDebug::Print(t);} |
|
82 #define __MSDEVPRINT1(t,a) {RDebug::Print(t,a);} |
|
83 #define __MSDEVPRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
84 #else |
|
85 #define __MSDEVPRINT(t) |
|
86 #define __MSDEVPRINT1(t,a) |
|
87 #define __MSDEVPRINT2(t,a,b) |
|
88 #endif // _MSDEVICE_DEBUG_PRINT_ |
|
89 |
|
90 #endif // DEBUG_H |
|