|
1 /* |
|
2 * Copyright (c) 2006 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: Debug macros for Psln. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef PSLNDEBUG_H |
|
20 #define PSLNDEBUG_H |
|
21 |
|
22 // MACROS |
|
23 |
|
24 // If PSLN_TRACING_ENABLED is defined, tracing will be enabled (all levels) |
|
25 // |
|
26 // Alternatively, the following macros can be used to enable traces: |
|
27 // PSLN_TRACING_ENABLED_INFO Informative traces |
|
28 // PSLN_TRACING_ENABLED_NORMAL Normal traces |
|
29 // PSLN_TRACING_ENABLED_ERROR Error traces |
|
30 // Default for debug builds is NORMAL and ERROR |
|
31 |
|
32 #if defined(_DEBUG) |
|
33 #define PSLN_TRACING_ENABLED_NORMAL |
|
34 #define PSLN_TRACING_ENABLED_ERROR |
|
35 #endif // _DEBUG |
|
36 |
|
37 #if defined(PSLN_TRACING_ENABLED) |
|
38 #undef PSLN_TRACING_ENABLED_INFO |
|
39 #define PSLN_TRACING_ENABLED_INFO |
|
40 #undef PSLN_TRACING_ENABLED_NORMAL |
|
41 #define PSLN_TRACING_ENABLED_NORMAL |
|
42 #undef PSLN_TRACING_ENABLED_ERROR |
|
43 #define PSLN_TRACING_ENABLED_ERROR |
|
44 #endif // PSLN_TRACING_ENABLED |
|
45 |
|
46 #if defined(PSLN_TRACING_ENABLED_INFO) || defined(PSLN_TRACING_ENABLED_NORMAL) || defined(PSLN_TRACING_ENABLED_ERROR) |
|
47 #if !defined(__E32SVR_H__) |
|
48 #include <e32svr.h> |
|
49 #endif // __E32SVR_H__ |
|
50 |
|
51 #define PSLN_TRACECMDPFX RDebug::Print |
|
52 #define PSLN_TRACECMDSFX |
|
53 #define PSLN_TRACE_ADDPREFIX(aText) (TPtrC((const TText *)L"PSLN: \"" L##aText L"\"")) |
|
54 #endif // PSLN_TRACING_ENABLED_INFO || PSLN_TRACING_ENABLED_NORMAL || PSLN_TRACING_ENABLED_ERROR |
|
55 |
|
56 #if defined(PSLN_TRACING_ENABLED_INFO) |
|
57 #pragma message("PslnDebug: Info-mode tracing is enabled, performance will be degraded!") |
|
58 #define PSLN_TRACE_ADDPREFIX_INFO(aText) (TPtrC((const TText *)L"PSLN: (Info) \"" L##aText L"\"")) |
|
59 #define PSLN_TRACE_INFO(aMsg) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX_INFO(aMsg) ) PSLN_TRACECMDSFX |
|
60 #define PSLN_TRACE_INFO1(aFormat,aP1) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX_INFO(aFormat),(aP1) ) PSLN_TRACECMDSFX |
|
61 #define PSLN_TRACE_INFO2(aFormat,aP1,aP2) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX_INFO(aFormat),(aP1),(aP2) ) PSLN_TRACECMDSFX |
|
62 #define PSLN_TRACE_INFO3(aFormat,aP1,aP2,aP3) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX_INFO(aFormat),(aP1),(aP2),(aP3) ) PSLN_TRACECMDSFX |
|
63 #else |
|
64 #define PSLN_TRACE_INFO(aMsg) |
|
65 #define PSLN_TRACE_INFO1(aFormat,aP1) |
|
66 #define PSLN_TRACE_INFO2(aFormat,aP1,aP2) |
|
67 #define PSLN_TRACE_INFO3(aFormat,aP1,aP2,aP3) |
|
68 #endif // PSLN_TRACING_ENABLED_INFO |
|
69 |
|
70 #if defined(PSLN_TRACING_ENABLED_NORMAL) |
|
71 #define PSLN_TRACE_DEBUG(aMsg) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX(aMsg) ) PSLN_TRACECMDSFX |
|
72 #define PSLN_TRACE_DEBUG1(aFormat,aP1) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX(aFormat),(aP1) ) PSLN_TRACECMDSFX |
|
73 #define PSLN_TRACE_DEBUG2(aFormat,aP1,aP2) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX(aFormat),(aP1),(aP2) ) PSLN_TRACECMDSFX |
|
74 #define PSLN_TRACE_DEBUG3(aFormat,aP1,aP2,aP3) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX(aFormat),(aP1),(aP2),(aP3) ) PSLN_TRACECMDSFX |
|
75 #else |
|
76 #define PSLN_TRACE_DEBUG(aMsg) |
|
77 #define PSLN_TRACE_DEBUG1(aFormat,aP1) |
|
78 #define PSLN_TRACE_DEBUG2(aFormat,aP1,aP2) |
|
79 #define PSLN_TRACE_DEBUG3(aFormat,aP1,aP2,aP3) |
|
80 #endif // PSLN_TRACING_ENABLED_NORMAL |
|
81 |
|
82 #if defined(PSLN_TRACING_ENABLED_ERROR) |
|
83 #define PSLN_TRACE_ADDPREFIX_ERROR(aText) (TPtrC((const TText *)L"PSLN: (Error) \"" L##aText L"\"")) |
|
84 #define PSLN_TRACE_ERROR(aMsg) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX_ERROR(aMsg) ) PSLN_TRACECMDSFX |
|
85 #define PSLN_TRACE_ERROR1(aFormat,aP1) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX_ERROR(aFormat),(aP1) ) PSLN_TRACECMDSFX |
|
86 #define PSLN_TRACE_ERROR2(aFormat,aP1,aP2) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX_ERROR(aFormat),(aP1),(aP2) ) PSLN_TRACECMDSFX |
|
87 #define PSLN_TRACE_ERROR3(aFormat,aP1,aP2,aP3) PSLN_TRACECMDPFX ( PSLN_TRACE_ADDPREFIX_ERROR(aFormat),(aP1),(aP2),(aP3) ) PSLN_TRACECMDSFX |
|
88 #define PSLN_TRACE_OBSOLETE(aFunc) PSLN_TRACECMDPFX ( _L("PSLN: (Error) Obsolete function %s used"), _S(aFunc) ) PSLN_TRACECMDSFX |
|
89 #else |
|
90 #define PSLN_TRACE_ERROR(aMsg) |
|
91 #define PSLN_TRACE_ERROR1(aFormat,aP1) |
|
92 #define PSLN_TRACE_ERROR2(aFormat,aP1,aP2) |
|
93 #define PSLN_TRACE_ERROR3(aFormat,aP1,aP2,aP3) |
|
94 #define PSLN_TRACE_OBSOLETE(aFunc) |
|
95 #endif // PSLN_TRACING_ENABLED_ERROR |
|
96 |
|
97 //lint -e960 Disable null statement note |
|
98 //lint -esym(755,PSLN_TRACE*) Used in debug only |
|
99 |
|
100 #endif // PSLNDEBUG_H |
|
101 |
|
102 // End of File |