1 // |
|
2 // * Copyright 2004 Neusoft America Inc. |
|
3 // * All rights reserved. |
|
4 // * This component and the accompanying materials are made available |
|
5 // * under the terms of the 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 // * Contributors: |
|
10 // * Keith Collins (Neusoft America Inc.) original software development and additional code and modifications. |
|
11 // * Thomas Gahagen (Neusoft America Inc.) additional code and modifications. |
|
12 // * Zhen Yuan (Neusoft America Inc.) additional code and modifications. |
|
13 // * |
|
14 // * Description: This file defines the CCsyDebugLogger class for the CSY and the macros |
|
15 // * to use for logging debug messages to either a serial port or a log file. |
|
16 // |
|
17 |
|
18 // CsyDebugLogger.h |
|
19 |
|
20 /** @file CsyDebugLogger.h |
|
21 * |
|
22 */ |
|
23 |
|
24 #ifndef __CSYDEBUGLOGGER_H__ |
|
25 #define __CSYDEBUGLOGGER_H__ |
|
26 |
|
27 #ifdef _DEBUG |
|
28 |
|
29 // To reduce debugging - comment out one or more of these defines |
|
30 |
|
31 #define __DEBUGLEVELCRITICAL__ // Critical logging (erroneous conditions) |
|
32 #define __DEBUGLEVELMAJOR__ // Major (important data used in the Csy) |
|
33 #define __DEBUGLEVELMINOR__ // Minor (important conditions) |
|
34 #define __DEBUGLEVELDETAILED__ // Detailed (comments & func >> << logging) |
|
35 |
|
36 // Route for logging - select one of these |
|
37 #define __DEBUGLOGFILE__ |
|
38 //#define __DEBUGSERIALPORT__ |
|
39 |
|
40 #define LOGHEADER() CCsyDebugLogger::WriteHeader() |
|
41 #else |
|
42 #define LOGHEADER() |
|
43 #endif |
|
44 |
|
45 #ifdef __DEBUGLEVELCRITICAL__ |
|
46 #define _LOG_L1C1(AAA) CCsyDebugLogger::Write(_L8(AAA)) |
|
47 #define _LOG_L1C2(AAA, BBB) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB) |
|
48 #define _LOG_L1C3(AAA, BBB, CCC) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB,CCC) |
|
49 #else |
|
50 #define _LOG_L1C1(AAA) |
|
51 #define _LOG_L1C2(AAA, BBB) (void) BBB; |
|
52 #define _LOG_L1C3(AAA, BBB, CCC) (void) BBB; (void) CCC; |
|
53 #endif |
|
54 |
|
55 #ifdef __DEBUGLEVELMAJOR__ |
|
56 #define _LOG_L2C1(AAA) CCsyDebugLogger::Write(_L8(AAA)) |
|
57 #define _LOG_L2C2(AAA, BBB) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB) |
|
58 #define _LOG_L2C3(AAA, BBB, CCC) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB,CCC) |
|
59 #else |
|
60 #define _LOG_L2C1(AAA) |
|
61 #define _LOG_L2C2(AAA, BBB) (void) BBB; |
|
62 #define _LOG_L2C3(AAA, BBB, CCC) (void) BBB; (void) CCC; |
|
63 #endif |
|
64 |
|
65 #ifdef __DEBUGLEVELMINOR__ |
|
66 #define _LOG_L3C1(AAA) CCsyDebugLogger::Write(_L8(AAA)) |
|
67 #define _LOG_L3C2(AAA, BBB) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB) |
|
68 #define _LOG_L3C3(AAA, BBB, CCC) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB,CCC) |
|
69 #else |
|
70 #define _LOG_L3C1(AAA) |
|
71 #define _LOG_L3C2(AAA, BBB) (void) BBB; |
|
72 #define _LOG_L3C3(AAA, BBB, CCC) (void) BBB; (void) CCC; |
|
73 #endif |
|
74 |
|
75 #ifdef __DEBUGLEVELDETAILED__ |
|
76 #define _LOG_L4C1(AAA) CCsyDebugLogger::Write(_L8(AAA)) |
|
77 #define _LOG_L4C2(AAA, BBB) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB) |
|
78 #define _LOG_L4C3(AAA, BBB, CCC) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB,CCC) |
|
79 #else |
|
80 #define _LOG_L4C1(AAA) |
|
81 #define _LOG_L4C2(AAA, BBB) (void) BBB; |
|
82 #define _LOG_L4C3(AAA, BBB, CCC) (void) BBB; (void) CCC; |
|
83 #endif |
|
84 |
|
85 |
|
86 |
|
87 // The following logging macros are the same as those above with the following exception: |
|
88 // The arguments are removed from the code when the logging is removed. |
|
89 // This is needed to remove warnings where otherwise unused variables are logged. |
|
90 |
|
91 #ifdef __DEBUGLEVELCRITICAL__ |
|
92 #define _LOG_L1C1E(AAA) CCsyDebugLogger::Write(_L8(AAA)) |
|
93 #define _LOG_L1C2E(AAA, BBB) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB) |
|
94 #define _LOG_L1C3E(AAA, BBB, CCC) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB,CCC) |
|
95 #else |
|
96 #define _LOG_L1C1E(AAA) |
|
97 #define _LOG_L1C2E(AAA, BBB) |
|
98 #define _LOG_L1C3E(AAA, BBB, CCC) |
|
99 #endif |
|
100 |
|
101 #ifdef __DEBUGLEVELMAJOR__ |
|
102 #define _LOG_L2C1E(AAA) CCsyDebugLogger::Write(_L8(AAA)) |
|
103 #define _LOG_L2C2E(AAA, BBB) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB) |
|
104 #define _LOG_L2C3E(AAA, BBB, CCC) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB,CCC) |
|
105 #else |
|
106 #define _LOG_L2C1E(AAA) |
|
107 #define _LOG_L2C2E(AAA, BBB) |
|
108 #define _LOG_L2C3E(AAA, BBB, CCC) |
|
109 #endif |
|
110 |
|
111 #ifdef __DEBUGLEVELMINOR__ |
|
112 #define _LOG_L3C1E(AAA) CCsyDebugLogger::Write(_L8(AAA)) |
|
113 #define _LOG_L3C2E(AAA, BBB) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB) |
|
114 #define _LOG_L3C3E(AAA, BBB, CCC) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB,CCC) |
|
115 #else |
|
116 #define _LOG_L3C1E(AAA) |
|
117 #define _LOG_L3C2E(AAA, BBB) |
|
118 #define _LOG_L3C3E(AAA, BBB, CCC) |
|
119 #endif |
|
120 |
|
121 #ifdef __DEBUGLEVELDETAILED__ |
|
122 #define _LOG_L4C1E(AAA) CCsyDebugLogger::Write(_L8(AAA)) |
|
123 #define _LOG_L4C2E(AAA, BBB) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB) |
|
124 #define _LOG_L4C3E(AAA, BBB, CCC) CCsyDebugLogger::WriteFormat(_L8(AAA),BBB,CCC) |
|
125 #else |
|
126 #define _LOG_L4C1E(AAA) |
|
127 #define _LOG_L4C2E(AAA, BBB) |
|
128 #define _LOG_L4C3E(AAA, BBB, CCC) |
|
129 #endif |
|
130 |
|
131 #include <flogger.h> |
|
132 |
|
133 class CCsyDebugLogger : public CBase |
|
134 { |
|
135 public: |
|
136 static void WriteHeader(); |
|
137 static void Write(const TDesC8& aText); |
|
138 static void WriteFormat(TRefByValue<const TDesC8> aFmt, ...); |
|
139 }; |
|
140 |
|
141 #endif // __CSYDEBUGLOGGER_H__ |
|