|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Central place for debug-type macros |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 #ifndef SEN_LOGGER_H |
|
29 #define SEN_LOGGER_H |
|
30 |
|
31 // Note that _DEBUG is automatically defined for debug builds |
|
32 |
|
33 |
|
34 #include "sendebug.h" |
|
35 #include <senpointermap.h> |
|
36 // INCLUDE |
|
37 #include <e32svr.h> |
|
38 #include <flogger.h> |
|
39 |
|
40 // CONSTANTS |
|
41 |
|
42 // Utilized by TLS-loggers: |
|
43 |
|
44 const TInt KMaxLogLevel =2; |
|
45 const TInt KNormalLogLevel =1; |
|
46 const TInt KMinLogLevel =0; |
|
47 |
|
48 const TInt KSenServiceConnectionLogChannelBase = 1000; |
|
49 const TInt KSenServiceConnectionLogChannel =18000; |
|
50 const TInt KSenServiceConnectionLogLevel =0; |
|
51 const TInt KSenServiceConnectionStatusLogChannelBase = 1100; |
|
52 const TInt KSenServiceConnectionStatusLogLevel = 0; |
|
53 _LIT(KSenServiceConnectionLogDir, "WsLog"); |
|
54 _LIT(KSenServiceConnectionLogFile, "SenServiceConn.log"); |
|
55 _LIT(KSenServiceConnectionStatusLogFile, "SenServiceConnStatus.log"); |
|
56 |
|
57 const TInt KSenServiceManagerLogChannelBase = 2000; |
|
58 const TInt KSenServiceManagerLogChannel = 19000; |
|
59 const TInt KSenServiceManagerLogLevel = 0; |
|
60 _LIT(KSenServiceManagerLogDir, "WsLog"); |
|
61 _LIT(KSenServiceManagerLogFile, "SenServiceMgr.log"); |
|
62 |
|
63 const TInt KSenHttpChannelLogChannelBase = 3000; |
|
64 const TInt KSenHttpChannelLogLevel = 0; |
|
65 |
|
66 _LIT(KSenHttpChannelLogDir, "WsLog"); |
|
67 _LIT(KSenHttpChannelLogFile, "SenHttpChannel.log"); |
|
68 |
|
69 |
|
70 const TInt KSenHostletConnectionLogChannelBase = 4000; |
|
71 const TInt KSenHostletConnectionLogLevel = 0; |
|
72 _LIT(KSenHostletConnectionLogDir, "WsLog"); |
|
73 _LIT(KSenHostletConnectionLogFile, "SenHostletConnection.log"); |
|
74 |
|
75 |
|
76 const TInt KSenCoreServiceManagerLogChannelBase = 5000; |
|
77 const TInt KSenCoreServiceManagerStatusLogChannelBase = 1200; |
|
78 const TInt KSenCoreServiceManagerLogLevel = 0; |
|
79 _LIT(KSenCoreServiceManagerLogDir, "WsLog"); |
|
80 _LIT(KSenCoreServiceManagerLogFile, "SenCoreServiceManagerTLS.log"); |
|
81 |
|
82 |
|
83 const TInt KSenFaultsLogChannel = 6000; |
|
84 const TInt KSenFaultsLogLevel = 0; |
|
85 _LIT(KSenFaults, "WsLog"); |
|
86 _LIT(KSenFaultsLog, "SenFaults.log"); |
|
87 |
|
88 |
|
89 const TInt KSenUtilsLogChannel =7000; |
|
90 const TInt KSenUtilsLogLevel = 0; |
|
91 _LIT(KSenUtils, "WsLog"); |
|
92 _LIT(KSenUtilsLog, "SenUtils.log"); |
|
93 |
|
94 |
|
95 const TInt KSenServConnLogChannelBase = 8000; |
|
96 const TInt KSenServConnLogLevel = 0; |
|
97 _LIT(KSenServConn, "WsLog"); |
|
98 _LIT(KSenServConnLog, "SenServicePolicy.log"); |
|
99 |
|
100 |
|
101 const TInt KSenHttpChannelObserverLogChannelBase = 9000; |
|
102 const TInt KSenHttpChannelObserverLogLevel = 0; |
|
103 _LIT(KSenHttpChannelObserverLogDir, "WsLog"); |
|
104 _LIT(KSenHttpChannelObserverLogFile, "SenHttpChannelObserver.log"); |
|
105 |
|
106 |
|
107 const TInt KSenLocalTransportLogChannelBase = 10000; |
|
108 const TInt KSenLocalTransportLogLevel = 0; |
|
109 _LIT(KSenLocalTransportLogDir, "WsLog"); |
|
110 _LIT(KSenLocalTransportLogFile, "SenLocalTransport.log"); |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 const TInt KSenPolicyLogChannelBase = 11000; |
|
116 const TInt KSenPolicyLogLevel = 0; |
|
117 _LIT(KSenPolicyLogDir, " WsLog"); |
|
118 _LIT(KSenPolicyLogFile, "SenPolicy.log"); |
|
119 |
|
120 |
|
121 |
|
122 const TInt KSenVtcpLogChannelBase = 12000; |
|
123 const TInt KSenVtcpLogLevel = 0; |
|
124 _LIT(KSenVtcpLogFileDir, "WsLog"); |
|
125 _LIT(KSenVtcpLogFile, "SenVtcp.log"); |
|
126 |
|
127 |
|
128 |
|
129 const TInt KSenVtcpObserverLogChannelBase = 13000; |
|
130 const TInt KSenVtcpObserverLogLevel = 0; |
|
131 _LIT(KSenVtcpObserverLogDir, "WsLog"); |
|
132 _LIT(KSenVtcpObserverLogFile, "SenVtcpObserver.log"); |
|
133 |
|
134 |
|
135 |
|
136 const TInt KSenVtcpDispatcherLogChannel = 13500; |
|
137 const TInt KSenVtcpDispatcherLogLevel = 0; |
|
138 _LIT(KSenVtcpDispatcherLogDir, "WsLog"); |
|
139 _LIT(KSenVtcpDispatcherLogFile, "SenVtcpDispatcher.log"); |
|
140 |
|
141 |
|
142 |
|
143 const TInt KSenMessagesLogChannel = 14000; |
|
144 const TInt KSenMessagesLogLevel = 0; |
|
145 _LIT(KSenMessages, "WsLog"); |
|
146 _LIT(KSenMessagesLog, "SenMessages.log"); |
|
147 |
|
148 |
|
149 const TInt KSenCredsLogChannel = 15000; |
|
150 const TInt KSenCredsLogLevelMin = 1; |
|
151 const TInt KSenCredsLogLevelNormal = 2; |
|
152 const TInt KSenCredsLogLevelMax = 3; |
|
153 _LIT(KSenCreds, "WsLog"); |
|
154 _LIT(KSenCredsLog, "SenCreds.log"); |
|
155 |
|
156 |
|
157 const TInt KSenXmlLogChannel = 16000; |
|
158 const TInt KSenXmlLogLevel = 0; |
|
159 _LIT(KSenXml, "WsLog"); |
|
160 _LIT(KSenXmlLog, "SenXml.log"); |
|
161 |
|
162 const TInt KSenClientSessionLogChannelBase = 17000; |
|
163 const TInt KSenClientSessionLogLevel =0; |
|
164 |
|
165 const TInt KHostletTransportLogChannel = 20000; |
|
166 const TInt KHostletTransportLogLevel = 0; |
|
167 _LIT(KLogDir, "WsLog"); |
|
168 _LIT(KLogFile, "SenHostletTransport.log"); |
|
169 |
|
170 const TInt KSenNcimLogChannelAsync = 21000; |
|
171 const TInt KSenNcimLogChannelMsg = 21001; |
|
172 const TInt KSenNcimLogChannelGeneral = 21002; |
|
173 const TInt KSenNcimLogLevel = 0; |
|
174 _LIT(KSenNcimLogDir, "WsLog"); |
|
175 _LIT(KSenNcimLogFileAsync, "SenNcimAsync.log"); |
|
176 _LIT(KSenNcimLogFileMsg, "SenNcimMsg.log"); |
|
177 _LIT(KSenNcimLogFileGen, "SenNcimGen.log"); |
|
178 |
|
179 const TInt KSenDispatcherLogChannel = 22000; |
|
180 const TInt KSenDispatcherLogLevel = 0; |
|
181 _LIT(KSenDispactherThread, "WsLog"); |
|
182 _LIT(KSenDispactherThreadLog, "SenDispatcherThread.log"); |
|
183 |
|
184 /* |
|
185 templates |
|
186 Reqest |
|
187 _L8(" | | | ----------> Request(Invoke Public)")); |
|
188 |
|
189 Complet |
|
190 _L8(" | | | ---< Complete")); |
|
191 |
|
192 Runl |
|
193 _L8(" | | | <---- RunL ")); |
|
194 */ |
|
195 #ifdef __ENABLE_ALR__ |
|
196 const TInt KSenSenMobilityLogChannelBase = 27000; |
|
197 const TInt KSenSenMobilityLogLevel =0; |
|
198 _LIT(KSenMobilityDir, "WsLog"); |
|
199 _LIT(KSenMobilityLog, "SenMobility.log"); |
|
200 #endif // __ENABLE_ALR__ |
|
201 |
|
202 // WS PAOS HTTP filter |
|
203 const TInt KPoasFilterLogChannel = 30000; |
|
204 const TInt KPoasFilterLogLevel = 0; |
|
205 _LIT( KPoasLogFileDir, "WsLog" ); |
|
206 _LIT( KPoasLogFileName, "WsPaosFilter.log" ); |
|
207 |
|
208 // WS HTTP filter (pairs with PAOS filter) |
|
209 const TInt KWsHttpFilterLogChannel = 31000; |
|
210 const TInt KWsHttpFilterLogLevel = 0; |
|
211 _LIT( KWsHttpFilterLogFileDir, "WsLog" ); |
|
212 _LIT( KWsHttpFilterLogFileName, "WsHttpFilter.log" ); |
|
213 |
|
214 class CSenLogger; |
|
215 class CWSConnectionProxy; |
|
216 |
|
217 typedef struct |
|
218 { |
|
219 RFileLogger iLog; |
|
220 TInt iCount; |
|
221 TInt iChannel; |
|
222 TInt iLevel; |
|
223 } TLog; |
|
224 |
|
225 typedef struct |
|
226 { |
|
227 CSenLogger* iLogger; |
|
228 CWSConnectionProxy* iProxy; |
|
229 } TWsTls; |
|
230 |
|
231 // CLASS DECLARATION |
|
232 class CSenLogger : public CBase |
|
233 { |
|
234 public: // New functions |
|
235 /** |
|
236 * Creates the global ESenDebug object. |
|
237 */ |
|
238 IMPORT_C static TInt CreateL(TInt aChannel, TInt aLevel, const TDesC& aLogDir, const TDesC& aLogFileName); |
|
239 IMPORT_C static TInt CreateL(TInt aChannel, TInt aLevel, const TDesC& aLogDir, const TDesC& aLogFileName, TFileLoggingMode aMode); |
|
240 |
|
241 /** |
|
242 * Destroys the global ESenDebug object. |
|
243 */ |
|
244 IMPORT_C static void Destroy(TInt aChannel); |
|
245 |
|
246 // 8-bit UCS2 variants: |
|
247 IMPORT_C static void Write(TInt aChannel, TInt aLevel, const TDesC8& aText); |
|
248 IMPORT_C static void WriteAll(TInt aChannel, TInt aLevel, const TDesC8& aText); |
|
249 IMPORT_C static void WriteFormat(TInt aChannel, TInt aLevel, TRefByValue<const TDesC8> aFmt,...); |
|
250 IMPORT_C static void WriteFormat(TInt aChannel, TInt aLevel, TRefByValue<const TDesC8> aFmt, VA_LIST& aList); |
|
251 |
|
252 IMPORT_C static void WriteWithClientId(TInt aClientId, TInt aChannel, TInt aLevel, const TDesC8& aText); |
|
253 IMPORT_C static void WriteAllWithClientId(TInt aClientId, TInt aChannel, TInt aLevel, const TDesC8& aText); |
|
254 IMPORT_C static void WriteFormatWithClientId(TInt aClientId, TInt aChannel, TInt aLevel, TRefByValue<const TDesC8> aFmt,...); |
|
255 IMPORT_C static void WriteFormatWithClientId(TInt aClientId, TInt aChannel, TInt aLevel, TRefByValue<const TDesC8> aFmt, VA_LIST& aList); |
|
256 IMPORT_C static void WriteFormatWithClientIdToMainLogs(TInt aClientId, TInt aLevel, TRefByValue<const TDesC8> aFmt,...); |
|
257 IMPORT_C static void WriteFormatWithClientIdToMainLogs(TInt aClientId, TInt aLevel, TRefByValue<const TDesC8> aFmt, VA_LIST& aList); |
|
258 |
|
259 |
|
260 // 16-bit Unicode variants: |
|
261 IMPORT_C static void Write(TInt aChannel, TInt aLevel, const TDesC16& aText); |
|
262 IMPORT_C static void WriteAll(TInt aChannel, TInt aLevel, const TDesC16& aText); |
|
263 IMPORT_C static void WriteFormat(TInt aChannel, TInt aLevel, TRefByValue<const TDesC16> aFmt,...); |
|
264 IMPORT_C static void WriteFormat(TInt aChannel, TInt aLevel, TRefByValue<const TDesC16> aFmt, VA_LIST& aList); |
|
265 |
|
266 // 16-bit Unicode variants: |
|
267 IMPORT_C static void WriteWithClientId(TInt aClientId, TInt aChannel, TInt aLevel, const TDesC16& aText); |
|
268 IMPORT_C static void WriteAllWithClientId(TInt aClientId, TInt aChannel, TInt aLevel, const TDesC16& aText); |
|
269 |
|
270 IMPORT_C static void WriteFormatWithClientId(TInt aClientId, TInt aChannel, TInt aLevel, TRefByValue<const TDesC16> aFmt,...); |
|
271 IMPORT_C static void WriteFormatWithClientId(TInt aClientId, TInt aChannel, TInt aLevel, TRefByValue<const TDesC16> aFmt, VA_LIST& aList); |
|
272 IMPORT_C static void WriteFormatWithClientIdToMainLogs(TInt aClientId, TInt aLevel, TRefByValue<const TDesC16> aFmt,...); |
|
273 IMPORT_C static void WriteFormatWithClientIdToMainLogs(TInt aClientId, TInt aLevel, TRefByValue<const TDesC16> aFmt, VA_LIST& aList); |
|
274 |
|
275 private: // Constructor and destructor |
|
276 TInt ChannelIndex(TInt aChannel) const; |
|
277 static RFileLogger* Logger(TInt aChannel, TInt aLevel); |
|
278 |
|
279 /** |
|
280 * Constructor. |
|
281 */ |
|
282 IMPORT_C CSenLogger(); |
|
283 |
|
284 /** |
|
285 * Destructor. |
|
286 */ |
|
287 virtual ~CSenLogger(); |
|
288 |
|
289 private: // Data |
|
290 TInt iCount; |
|
291 RPointerArray<TLog> iLogs; |
|
292 RSenPointerMap<TInt,TInt> iMap; |
|
293 |
|
294 }; |
|
295 |
|
296 #ifdef _SENDEBUG |
|
297 #define TLSLOG_OPEN(channel, level, logdir, logfile) CSenLogger::CreateL(channel, level, logdir, logfile) |
|
298 #define TLSLOG_OPEN_TO_MODE(channel, level, logdir, logfile, loggingmode) CSenLogger::CreateL(channel, level, logdir, logfile, loggingmode) |
|
299 #define TLSLOG(channel, level, string) CSenLogger::Write(channel, level, string) |
|
300 #define TLSLOG_L(channel, level, string) CSenLogger::Write(channel, level, _L(string)) |
|
301 #define TLSLOG_FORMAT(parameters) CSenLogger::WriteFormat parameters |
|
302 #define TLSLOG_ALL(channel, level, string) CSenLogger::WriteAll(channel, level, string) |
|
303 #define TLSLOG_CLOSE(channel) CSenLogger::Destroy(channel) |
|
304 #else // _SENDEBUG not defined: |
|
305 #define TLSLOG_OPEN(channel, level, logdir, logfile) |
|
306 #define TLSLOG_OPEN_TO_MODE(channel, level, logdir, logfile, loggingmode) |
|
307 #define TLSLOG_L(channel, level, string) |
|
308 #define TLSLOG(channel, level, string) |
|
309 #define TLSLOG_ALL(channel, level, string) |
|
310 #define TLSLOG_FORMAT(parameters) |
|
311 #define TLSLOG_CLOSE(channel) |
|
312 #define CSLOG(clientid, level, string) |
|
313 #define CSLOG_L(clientid, level, string) |
|
314 #define CSLOG_FORMAT(parameters) |
|
315 #define CSLOG_ALL(clientid, level, string) |
|
316 #endif // _DEBUG |
|
317 |
|
318 #ifdef _SENDEBUG |
|
319 //#ifndef TRUE // disabling CS logs (for testing purposes) |
|
320 // Core-side, Client Session logging methods: |
|
321 // #define CSLOG_OPEN(clientid, level, logdir, logfile) CSenLogger::CreateWithClientIdL(channel, level, logdir, logfile) |
|
322 #define CSLOG(clientid, level, string) CSenLogger::WriteWithClientId(clientid, KSenClientSessionLogChannelBase+clientid, level, string);\ |
|
323 CSenLogger::WriteWithClientId(clientid, KSenCoreServiceManagerLogChannelBase, level, string) |
|
324 |
|
325 #define CSLOG_L(clientid, level, string) CSenLogger::WriteWithClientId(clientid, KSenClientSessionLogChannelBase+clientid, level, _L(string));\ |
|
326 CSenLogger::WriteWithClientId(clientid, KSenCoreServiceManagerLogChannelBase, level, _L(string)) |
|
327 |
|
328 // aClientId, TInt aLevel, <format_string>, ... |
|
329 #define CSLOG_FORMAT(parameters) CSenLogger::WriteFormatWithClientIdToMainLogs parameters |
|
330 |
|
331 #define CSLOG_ALL(clientid, level, string) CSenLogger::WriteAllWithClientId(clientid, KSenClientSessionLogChannelBase+clientid, level, string);\ |
|
332 CSenLogger::WriteAllWithClientId(clientid, KSenCoreServiceManagerLogChannelBase, level, string) |
|
333 // #define CSLOG_CLOSE(clientid) CSenLogger::DestroyWithClientId(channel) |
|
334 #else // _SENDEBUG not defined: |
|
335 // #define CSLOG_OPEN(clientid, level, logdir, logfile) |
|
336 #define CSLOG(clientid, level, string) |
|
337 #define CSLOG_L(clientid, level, string) |
|
338 #define CSLOG_FORMAT(parameters) |
|
339 #define CSLOG_ALL(clientid, level, string) |
|
340 // #define CSLOG_CLOSE(clientid) |
|
341 #endif // _DEBUG |
|
342 |
|
343 |
|
344 |
|
345 #ifdef _SENDEBUG |
|
346 #define CREDLOG_OPEN() CSenLogger::CreateL(KSenCredsLogChannel, KSenCredsLogLevelMax, KSenCreds, KSenCredsLog) |
|
347 #define CREDLOG_L(level, string) CSenLogger::Write(KSenCredsLogChannel, level, _L(string)) |
|
348 #define CREDLOG(level, string) CSenLogger::Write(KSenCredsLogChannel, level, string) |
|
349 #define CREDLOG_ALL(level, string) CSenLogger::WriteAll(KSenCredsLogChannel, level, string) |
|
350 #define CREDLOG_FORMAT(parameters) CSenLogger::WriteFormat parameters |
|
351 #define CREDLOG_CLOSE() CSenLogger::Destroy(KSenCredsLogChannel) |
|
352 #else // _SENDEBUG not defined in <codebase>inc\webservices.hrh file: |
|
353 #define CREDLOG_OPEN() |
|
354 #define CREDLOG_L(level, string) |
|
355 #define CREDLOG(level, string) |
|
356 #define CREDLOG_ALL(level, string) |
|
357 #define CREDLOG_FORMAT(parameters) |
|
358 #define CREDLOG_CLOSE() |
|
359 #endif // _DEBUG |
|
360 |
|
361 #endif // SEN_LOGGER_H |
|
362 |
|
363 // End of File |