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 the License "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: |
|
15 * @file tmslog.h |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef TMSLOG_H |
|
26 #define TMSLOG_H |
|
27 |
|
28 //#define _TESTAPP_DEBUG_PRINT_ |
|
29 |
|
30 #if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
31 #include <e32debug.h> |
|
32 #endif |
|
33 |
|
34 #if defined(_TESTAPP_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) |
|
35 #define TRACE_ENABLED |
|
36 #endif |
|
37 |
|
38 #ifdef TRACE_ENABLED |
|
39 |
|
40 class TMsLogStaticFn |
|
41 { |
|
42 public: |
|
43 static const TInt KLogBufferSize = 0xFF; |
|
44 |
|
45 TMsLogStaticFn(const TDesC8& aFunctionName); |
|
46 |
|
47 ~TMsLogStaticFn(); |
|
48 |
|
49 protected: |
|
50 TBuf8<KLogBufferSize> buf; |
|
51 TPtrC8 iFunctionName; |
|
52 }; |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 class TMsLogFn |
|
58 { |
|
59 public: |
|
60 static const TInt KLogBufferSize = 0xFF; |
|
61 TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer); |
|
62 |
|
63 ~TMsLogFn(); |
|
64 |
|
65 private: |
|
66 TBuf8<KLogBufferSize> buf; |
|
67 TPtrC8 iFunctionName; |
|
68 void* iThisPointer; |
|
69 }; |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 #define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this); |
|
75 #define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); |
|
76 #else |
|
77 #define __MSFNSLOG |
|
78 #define __MSFNLOG |
|
79 #endif |
|
80 |
|
81 |
|
82 |
|
83 #ifdef TRACE_ENABLED |
|
84 #define __PRINT(t) {RDebug::Print(t);} |
|
85 #define __PRINT1(t,a) {RDebug::Print(t,a);} |
|
86 #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} |
|
87 #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} |
|
88 #else |
|
89 #define __PRINT(t) |
|
90 #define __PRINT1(t,a) |
|
91 #define __PRINT2(t,a,b) |
|
92 #define __PRINT3(t,a,b,c) |
|
93 |
|
94 #endif |
|
95 |
|
96 |
|
97 #endif // TMSLOG_H |
|