1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Header file describing trace utilities for commonemail |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #ifndef EMAILTRACE_H |
18 #ifndef EMAILTRACE_H |
19 #define EMAILTRACE_H |
19 #define EMAILTRACE_H |
20 |
20 |
21 #include "emailtraceconfig.hrh" |
21 #include <QCoreApplication> |
22 |
22 #include <QDebug> |
23 #ifdef TRACE_INTO_FILE |
23 #include <QFile> |
24 #include "cmaillogger.h" |
24 #include <QThread> |
25 #include <flogger.h> // RFileLogger |
25 #include <QDateTime> |
26 #else |
26 |
27 #include <e32debug.h> // RDebug |
27 /* |
28 #endif |
28 * The macros NM_COMMENT_TRACES, NM_ERROR_TRACES, and NM_FUNCTION_TRACES |
29 |
29 * control which debug messages are printed. The trace logging is controlled |
30 /** |
30 * with the NM_LOG_TO_FILE macro, whereas the NM_LOG_DIRECTORY macro defines |
31 * Constants |
31 * which directory is to be used to store the log files. The print_trace() |
32 */ |
32 * helper function implements printing. Log files are named according to |
33 #if defined(TRACE_INTO_FILE) |
33 * process and thread IDs. If NM_LOG_TO_FILE is zero or a log file cannot be |
34 |
34 * opened, the messages are printed to qDebug(). The DSC2STR() function can |
35 _LIT( KEmailDir, "email" ); |
35 * be used to convert Symbian descriptors to QString objects. |
36 _LIT( KEmailTraceFile, "email.txt" ); |
36 */ |
37 |
37 #if defined(DEBUG) || defined(_DEBUG) || NM_COMMENT_TRACES || NM_ERROR_TRACES || NM_FUNCTION_TRACES |
38 #endif |
38 |
39 |
39 #ifndef NM_COMMENT_TRACES |
40 #if defined(TRACE_FILE_LIMIT_SIZE) |
40 #define NM_COMMENT_TRACES 0 |
41 #define CMAIL_LOG_CLOSE CmailLogger::Close(); |
41 #endif |
42 #define CMAILLOGBUFFERSIZE 120 |
42 |
43 #else |
43 #ifndef NM_ERROR_TRACES |
44 #define CMAIL_LOG_CLOSE |
44 #define NM_ERROR_TRACES 0 |
45 #endif |
45 #endif |
46 |
46 |
47 //----------------------------------------------------------------------------- |
47 #ifndef NM_FUNCTION_TRACES |
48 // Error trace macros |
48 #define NM_FUNCTION_TRACES 0 |
49 //----------------------------------------------------------------------------- |
49 #endif |
50 // |
50 |
51 |
51 #if NM_COMMENT_TRACES || NM_ERROR_TRACES || NM_FUNCTION_TRACES |
52 #ifdef ERROR_TRACE |
52 |
53 |
53 #define NM_LOG_TO_FILE 1 |
54 /** |
54 #define NM_LOG_DIRECTORY "c:/data/logs/" |
55 * Error trace definitions. Does not automatically log the error code! |
55 |
56 */ |
56 inline void print_trace(const QString& msg) |
57 #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE) |
57 { |
58 |
58 static QFile file(NM_LOG_DIRECTORY+ |
59 #define ERROR( aErr, aMsg )\ |
59 QString("nmail_p%1_t%2.log"). |
60 {\ |
60 arg(QCoreApplication::applicationPid()). |
61 if( aErr != KErrNone )\ |
61 arg(QThread::currentThreadId())); |
62 {\ |
62 if (NM_LOG_TO_FILE && !file.isOpen()) { |
63 _LIT( KMsg, aMsg );\ |
63 file.open(QIODevice::Append | QIODevice::Text); |
64 RFileLogger::Write( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg );\ |
64 } |
65 }\ |
65 QDateTime dt = QDateTime::currentDateTime (); |
66 } |
66 if (file.isWritable()) { |
67 #define ERROR_1( aErr, aMsg, aP1 )\ |
67 QDebug(&file).nospace() << dt.toString(Qt::ISODate) << " " << msg << '\n'; |
68 {\ |
68 } else { |
69 if( aErr != KErrNone )\ |
69 qDebug().nospace() << "[Nmail] " << msg; |
70 {\ |
70 } |
71 _LIT( KMsg, aMsg );\ |
71 } |
72 RFileLogger::WriteFormat( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1 );\ |
72 |
73 }\ |
73 #endif |
74 } |
74 |
75 #define ERROR_2( aErr, aMsg, aP1, aP2 )\ |
75 inline QString DSC2STR(const TDesC& dsc) |
76 {\ |
76 { |
77 if( aErr != KErrNone )\ |
77 return QString::fromRawData(reinterpret_cast<const QChar*>(dsc.Ptr()), |
78 {\ |
78 dsc.Length()); |
79 _LIT( KMsg, aMsg );\ |
79 } |
80 RFileLogger::WriteFormat( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1, aP2 );\ |
80 |
81 }\ |
81 #else |
82 } |
82 |
83 #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\ |
83 #define DSC2STR(dsc) |
84 {\ |
84 |
85 if( aErr != KErrNone )\ |
85 #endif /* DEBUG */ |
86 {\ |
86 |
87 _LIT( KMsg, aMsg );\ |
87 /* |
88 RFileLogger::WriteFormat( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1, aP2, aP3 );\ |
88 * The function NM_COMMENT() prints a debug message. The INFO macros and the |
89 }\ |
89 * NMLOG macro are provided for legacy compatibility. They are deprecated and |
90 } |
90 * should not be used. If sprintf() type of formatting is desired, consider |
91 #define ERROR_GEN( aMsg ) ERROR( KErrGeneral, aMsg ) |
91 * using QString::arg() or QTextStream. |
92 #define ERROR_GEN_1( aMsg, aP1 ) ERROR_1( KErrGeneral, aMsg, aP1 ) |
92 */ |
93 #endif |
93 #if NM_COMMENT_TRACES |
94 #if defined(TRACE_INTO_FILE) && defined(TRACE_FILE_LIMIT_SIZE) |
94 |
95 |
95 inline void NM_COMMENT(const QString& msg) |
96 #define ERROR( aErr, aMsg )\ |
96 { |
97 {\ |
97 print_trace("COMMENT : " + msg); |
98 if( aErr != KErrNone )\ |
98 } |
99 {\ |
99 #define INFO(msg) NM_COMMENT(msg) |
100 _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KMsg(); if ( KMsg().Size() < buf.MaxSize() ) { CmailLogger::Write( buf ); }}\ |
100 #define INFO_1(msg,arg1)\ |
101 } |
101 do {\ |
102 |
102 QString __msg;\ |
103 #define ERROR_1( aErr, aMsg, aP1 )\ |
103 __msg.sprintf(msg,arg1);\ |
104 {\ |
104 NM_COMMENT(__msg);\ |
105 if( aErr != KErrNone )\ |
105 } while (0) |
106 {\ |
106 #define INFO_2(msg,arg1,arg2)\ |
107 _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8(); if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1 ); CmailLogger::Write( buf ); } }\ |
107 do {\ |
108 } |
108 QString __msg;\ |
109 #define ERROR_2( aErr, aMsg, aP1, aP2 )\ |
109 __msg.sprintf(msg,arg1,arg2);\ |
110 {\ |
110 NM_COMMENT(__msg);\ |
111 if( aErr != KErrNone )\ |
111 } while (0) |
112 {\ |
112 #define INFO_3(msg,arg1,arg2,arg3)\ |
113 _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8(); if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1, aP2 ); CmailLogger::Write( buf ); }} \ |
113 do {\ |
114 } |
114 QString __msg;\ |
115 #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\ |
115 __msg.sprintf(msg,arg1,arg2,arg3);\ |
116 {\ |
116 NM_COMMENT(__msg);\ |
117 if( aErr != KErrNone )\ |
117 } while (0) |
118 {\ |
118 #define NMLOG(msg) NM_COMMENT(msg) |
119 _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8(); if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1, aP2, aP3 ); CmailLogger::Write( buf ); }}\ |
119 |
120 } |
120 #else |
121 #endif |
121 |
122 #if !defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE) |
122 #define NM_COMMENT(msg) |
123 |
123 #define INFO(msg) |
124 #define ERROR( aErr, aMsg )\ |
124 #define INFO_1(msg,arg1) |
125 {\ |
125 #define INFO_2(msg,arg1,arg2) |
126 if( aErr != KErrNone )\ |
126 #define INFO_3(msg,arg1,arg2,arg3) |
127 {\ |
127 #define NMLOG(msg) |
128 _LIT( KMsg, aMsg ); RDebug::Print( KMsg );\ |
128 |
129 }\ |
129 #endif /* NM_COMMENT_TRACES */ |
130 } |
130 |
131 #define ERROR_1( aErr, aMsg, aP1 )\ |
131 /* |
132 {\ |
132 * The function NM_ERROR() prints its second argument if the first argument |
133 if( aErr != KErrNone )\ |
133 * is non-zero. The ERROR macros are provided for legacy compatibility. They |
134 {\ |
134 * are deprecated and should not be used. If sprintf() type of formatting is |
135 _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aP1 );\ |
135 * desired, consider using QString::arg() or QTextStream. |
136 }\ |
136 */ |
137 } |
137 #if NM_ERROR_TRACES |
138 #define ERROR_2( aErr, aMsg, aP1, aP2 )\ |
138 |
139 {\ |
139 inline void NM_ERROR(int err, const QString& msg) |
140 if( aErr != KErrNone )\ |
140 { |
141 {\ |
141 if (err) { |
142 _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aP1, aP2 );\ |
142 print_trace("ERROR : " + msg); |
143 }\ |
143 } |
144 } |
144 } |
145 #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\ |
145 #define ERROR(err,msg) NM_ERROR(err,msg) |
146 {\ |
146 #define ERROR_1(err,msg,arg1)\ |
147 if( aErr != KErrNone )\ |
147 do {\ |
148 {\ |
148 QString __msg;\ |
149 _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aP1, aP2, aP3 );\ |
149 __msg.sprintf(msg,arg1);\ |
150 }\ |
150 NM_ERROR(err,__msg);\ |
151 } |
151 } while (0) |
152 #define ERROR_GEN( aMsg ) ERROR( KErrGeneral, aMsg ) |
152 #define ERROR_2(err,msg,arg1,arg2)\ |
153 #define ERROR_GEN_1( aMsg, aP1 ) ERROR_1( KErrGeneral, aMsg, aP1 ) |
153 do {\ |
154 |
154 QString __msg;\ |
155 #endif//TRACE_INTO_FILE |
155 __msg.sprintf(msg,arg1,arg2);\ |
156 |
156 NM_ERROR(err,__msg);\ |
157 #else//ERROR_TRACE not defined |
157 } while(0) |
158 |
158 #define ERROR_3(err,msg,arg1,arg2,arg3)\ |
159 #define ERROR( aErr, aMsg ) |
159 do {\ |
160 #define ERROR_1( aErr, aMsg, aP1 ) |
160 QString __msg;\ |
161 #define ERROR_2( aErr, aMsg, aP1, aP2 ) |
161 __msg.sprintf(msg,arg1,arg2,arg3);\ |
162 #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 ) |
162 NM_ERROR(err,__msg);\ |
163 #define ERROR_GEN( aMsg ) |
163 } while(0) |
164 #define ERROR_GEN_1( aMsg, aP1 ) |
164 #define ERROR_GEN(msg) ERROR(KErrGeneral,msg) |
165 |
165 #define ERROR_GEN_1(msg,arg1) ERROR_1(KErrGeneral,msg,arg1) |
166 #endif//ERROR_TRACE |
166 |
167 |
167 #else |
168 |
168 |
169 //----------------------------------------------------------------------------- |
169 #define NM_ERROR(err,msg) |
170 // Info trace macros |
170 #define ERROR(err,msg) |
171 //----------------------------------------------------------------------------- |
171 #define ERROR_1(err,msg,arg1) |
172 // |
172 #define ERROR_2(err,msg,arg1,arg2) |
173 #if defined(INFO_TRACE) |
173 #define ERROR_3(err,msg,arg1,arg2,arg3) |
174 |
174 #define ERROR_GEN(msg) |
175 /** |
175 #define ERROR_GEN_1(msg,arg1) |
176 * Info log message definitions. |
176 |
177 */ |
177 #endif /* NM_ERROR_TRACES */ |
178 #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE) |
178 |
179 |
179 /* |
180 #define INFO( aMsg )\ |
180 * The macro NM_FUNCTION, when used inside a function body, enables tracing |
181 {\ |
181 * for a function. If used, it should be placed on the first line of the |
182 _LIT( KMsg, aMsg );\ |
182 * function body. ENTER and RETURN messages are printed when entering into |
183 RFileLogger::Write( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg );\ |
183 * and returning from a function, respectively. In case of an exception, |
184 } |
184 * UNWIND (for stack unwinding) is printed instead of RETURN. The FUNC_LOG |
185 #define INFO_1( aMsg, aP1 )\ |
185 * macro is provided for legacy compatibility. It is deprecated and should |
186 {\ |
186 * not be used. |
187 _LIT( KMsg, aMsg );\ |
187 */ |
188 RFileLogger::WriteFormat( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1 );\ |
188 #if NM_FUNCTION_TRACES |
189 } |
189 |
190 #define INFO_2( aMsg, aP1, aP2 )\ |
190 class __ftracer |
191 {\ |
191 { |
192 _LIT( KMsg, aMsg );\ |
192 public: |
193 RFileLogger::WriteFormat( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1, aP2 );\ |
193 __ftracer(const QString& _fn) |
194 } |
194 : fn(_fn) |
195 #define INFO_3( aMsg, aP1, aP2, aP3 )\ |
195 { |
196 {\ |
196 print_trace("ENTER : " + fn); |
197 _LIT( KMsg, aMsg );\ |
197 } |
198 RFileLogger::WriteFormat( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1, aP2, aP3 );\ |
198 ~__ftracer() |
199 } |
199 { |
200 #endif // // TRACE_INTO_FILE && TRACE_FILE_LIMIT_SIZE |
200 if (std::uncaught_exception()) { |
201 |
201 print_trace("UNWIND : " + fn); |
202 #if defined(TRACE_INTO_FILE) && defined(TRACE_FILE_LIMIT_SIZE) |
202 } else { |
203 #define CMAIL_LOG_INIT |
203 print_trace("RETURN : " + fn); |
204 |
204 } |
205 #define INFO( aMsg )\ |
205 } |
206 {\ |
206 private: |
207 _LIT8( KMsg, aMsg );\ |
207 QString fn; |
208 CmailLogger::Write( KMsg );\ |
208 }; |
209 } |
209 |
210 #define INFO_1( aMsg, aP1 )\ |
210 #define NM_FUNCTION __ftracer __ft(__PRETTY_FUNCTION__) |
211 { _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8();\ |
211 #define FUNC_LOG NM_FUNCTION |
212 if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1 ); }\ |
212 |
213 CmailLogger::Write( buf ); } |
213 #else |
214 #define INFO_2( aMsg, aP1, aP2 )\ |
214 |
215 { _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8();\ |
215 #define NM_FUNCTION |
216 if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1,aP2 ); }\ |
216 #define FUNC_LOG |
217 CmailLogger::Write( buf ); } |
217 |
218 #define INFO_3( aMsg, aP1, aP2, aP3 )\ |
218 #endif /* NM_FUNCTION_TRACES */ |
219 { _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8();\ |
219 |
220 if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1,aP2,aP3 ); }\ |
220 #endif /* EMAILTRACE_H */ |
221 CmailLogger::Write( buf ); } |
|
222 #endif // TRACE_INTO_FILE && TRACE_FILE_LIMIT_SIZE |
|
223 #if !defined(TRACE_INTO_FILE) |
|
224 |
|
225 #define INFO( aMsg )\ |
|
226 {\ |
|
227 _LIT( KMsg, aMsg ); RDebug::Print( KMsg );\ |
|
228 } |
|
229 #define INFO_1( aMsg, aP1 )\ |
|
230 {\ |
|
231 _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aP1 );\ |
|
232 } |
|
233 #define INFO_2( aMsg, aP1, aP2 )\ |
|
234 {\ |
|
235 _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aP1, aP2 );\ |
|
236 } |
|
237 #define INFO_3( aMsg, aP1, aP2, aP3 )\ |
|
238 {\ |
|
239 _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aP1, aP2, aP3 );\ |
|
240 } |
|
241 |
|
242 #endif//TRACE_INTO_FILE |
|
243 |
|
244 #else//INFO_TRACE not defined |
|
245 |
|
246 #define CMAIL_LOG_INIT |
|
247 #define CMAIL_LOG_CLOSE |
|
248 #define INFO( aMsg ) |
|
249 #define INFO_1( aMsg, aP1 ) |
|
250 #define INFO_2( aMsg, aP1, aP2 ) |
|
251 #define INFO_3( aMsg, aP1, aP2, aP3 ) |
|
252 |
|
253 #endif//INFO_TRACE |
|
254 |
|
255 //----------------------------------------------------------------------------- |
|
256 // Function trace macros |
|
257 //----------------------------------------------------------------------------- |
|
258 // |
|
259 |
|
260 #if defined (FUNC_TRACE) |
|
261 |
|
262 // Constants |
|
263 _LIT8( KEllipse, "(" ); |
|
264 |
|
265 // |
|
266 // Function logging definitions. |
|
267 // |
|
268 |
|
269 |
|
270 #if defined(TRACE_FILE_LIMIT_SIZE) |
|
271 #define FUNC( aMsg, aP1 )\ |
|
272 {\ |
|
273 _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8(); if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1 ); }CmailLogger::Write( buf ); } |
|
274 #endif |
|
275 #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE) |
|
276 #define FUNC( aMsg, aP1 )\ |
|
277 {\ |
|
278 _LIT8( KMsg, aMsg ); RFileLogger::WriteFormat( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1 );\ |
|
279 } |
|
280 #endif |
|
281 #if !defined(TRACE_INTO_FILE) |
|
282 #define FUNC( aMsg, aP1 )\ |
|
283 {\ |
|
284 RDebug::Printf( aMsg, aP1 );\ |
|
285 }\ |
|
286 |
|
287 #endif//TRACE_INTO_FILE |
|
288 |
|
289 /** |
|
290 * Function trace helper class. |
|
291 */ |
|
292 class TFuncLog |
|
293 { |
|
294 public: |
|
295 inline TFuncLog( const char* aFunc ): iFunc( (TUint8*)aFunc ) |
|
296 { |
|
297 TInt pos = iFunc.Find( KEllipse ); |
|
298 if( pos != KErrNotFound ) |
|
299 { |
|
300 iFunc.Set( iFunc.Left( iFunc.Find( KEllipse ) ) ); |
|
301 } |
|
302 #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE) |
|
303 |
|
304 //"CMAIL" string is added in the beginning of every trace |
|
305 //line for filtering purposes |
|
306 FUNC( "CMAIL %S <", &iFunc ); |
|
307 #endif |
|
308 #if defined(TRACE_INTO_FILE) && defined(TRACE_FILE_LIMIT_SIZE) |
|
309 TBuf8<CMAILLOGBUFFERSIZE> buf(iFunc); |
|
310 buf.Append(_L("<")); |
|
311 CmailLogger::Write( buf ); |
|
312 #endif |
|
313 #if !defined(TRACE_INTO_FILE) |
|
314 |
|
315 FUNC( "CMAIL %s <", iFunc.Ptr() ); |
|
316 |
|
317 #endif//TRACE_INTO_FILE |
|
318 } |
|
319 inline ~TFuncLog() |
|
320 { |
|
321 #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE) |
|
322 FUNC( "CMAIL %S >", &iFunc ); |
|
323 #endif |
|
324 #if defined(TRACE_INTO_FILE) && defined(TRACE_FILE_LIMIT_SIZE) |
|
325 TBuf8<CMAILLOGBUFFERSIZE> buf(iFunc); |
|
326 buf.Append(_L(">")); |
|
327 CmailLogger::Write( buf ); |
|
328 #endif |
|
329 #if !defined(TRACE_INTO_FILE) |
|
330 |
|
331 FUNC( "CMAIL %s >", iFunc.Ptr() ); |
|
332 #endif//TRACE_INTO_FILE |
|
333 } |
|
334 TPtrC8 iFunc; |
|
335 }; |
|
336 |
|
337 #define FUNC_LOG TFuncLog _fl( __PRETTY_FUNCTION__ ); |
|
338 #else//FUNC_TRACE not defined |
|
339 |
|
340 #define FUNC_LOG |
|
341 |
|
342 #endif//FUNC_TRACE |
|
343 |
|
344 //----------------------------------------------------------------------------- |
|
345 // Timestamp trace macros |
|
346 //----------------------------------------------------------------------------- |
|
347 // |
|
348 #if defined(TIMESTAMP_TRAC) |
|
349 |
|
350 #if defined(TRACE_INTO_FILE) |
|
351 |
|
352 #define TIMESTAMP( aCaption )\ |
|
353 {\ |
|
354 TTime t;\ |
|
355 t.HomeTime();\ |
|
356 TDateTime dt = t.DateTime();\ |
|
357 _LIT( KMsg, aCaption );\ |
|
358 _LIT( KFormat, "[TIMESTAMP] %d:%02d:%02d.%06d us %S");\ |
|
359 RFileLogger::WriteFormat( KEmailDir, KEmailTraceFile, EFileLoggingModeAppend, KFormat,\ |
|
360 dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond(), &KMsg );\ |
|
361 } |
|
362 |
|
363 #else//TRACE_INTO_FILE not defined |
|
364 |
|
365 #define TIMESTAMP( aCaption )\ |
|
366 {\ |
|
367 TTime t;\ |
|
368 t.HomeTime();\ |
|
369 TDateTime dt = t.DateTime();\ |
|
370 _LIT( KMsg, aCaption );\ |
|
371 _LIT( KFormat, "[TIMESTAMP] %d:%02d:%02d.%06d us %S");\ |
|
372 RDebug::Print( KFormat,\ |
|
373 dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond(), &KMsg );\ |
|
374 } |
|
375 |
|
376 #endif//TRACE_INTO_FILE |
|
377 |
|
378 #else//TIMESTAMP_TRACE not defined |
|
379 |
|
380 #define TIMESTAMP( aCaption ) |
|
381 |
|
382 #endif//TIMESTAMP_TRACE |
|
383 |
|
384 #endif // EMAILTRACE_H |
|