|
1 /* |
|
2 * Copyright (c) 2002 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: Logger facility for the Push MTM modules. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef PUSHMTMLOG_H |
|
21 #define PUSHMTMLOG_H |
|
22 |
|
23 // |
|
24 #ifdef __TEST_LOG__ |
|
25 // |
|
26 |
|
27 #include <e32std.h> |
|
28 #include <e32def.h> |
|
29 #include <flogger.h> |
|
30 |
|
31 _LIT( KPushLogDir, "PushMtm" ); |
|
32 _LIT( KPushLogFile, "PushLog.txt" ); |
|
33 _LIT( KPushLogEnterFn, "-> %S" ); |
|
34 _LIT( KPushLogLeaveFn, "<- %S" ); |
|
35 _LIT( KPushLogTimeFormatString, "%H:%T:%S:%*C2" ); |
|
36 _LIT( KPushLogTimeStampFormatString, "%S %S" ); |
|
37 |
|
38 #define PUSHLOG_ENTERFN(a) {_LIT(temp, a); RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, KPushLogEnterFn, &temp);} |
|
39 #define PUSHLOG_LEAVEFN(a) {_LIT(temp, a); RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, KPushLogLeaveFn, &temp);} |
|
40 #define PUSHLOG_WRITE(a) {_LIT(temp, a); RFileLogger::Write(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, temp);} |
|
41 #define PUSHLOG_WRITE_FORMAT(a,b) {_LIT(temp, a); RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, temp, b);} |
|
42 #define PUSHLOG_WRITE_FORMAT2(a,b,c) {_LIT(temp, a); RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, temp, b, c);} |
|
43 #define PUSHLOG_WRITE_TIMESTAMP(a) {_LIT(temp, a); TTime time; time.HomeTime(); TBuf<32> timeBuf; TRAPD(err, time.FormatL( timeBuf, KPushLogTimeFormatString )); if (!err) {RFileLogger::WriteFormat(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, KPushLogTimeStampFormatString, &temp, &timeBuf);} } |
|
44 // Use HEXDUMP with a TDesC8-derived parameter. |
|
45 #define PUSHLOG_HEXDUMP(aBuf) {RFileLogger::HexDump(KPushLogDir, KPushLogFile, EFileLoggingModeAppend, _S(" "), _S(" "), aBuf.Ptr(), aBuf.Size());} |
|
46 // Guard "log-only" argument name with this (expands to argument). |
|
47 #define LOG_ONLY( argName ) argName |
|
48 |
|
49 // |
|
50 #else // #ifndef __TEST_LOG__ |
|
51 // |
|
52 |
|
53 #define PUSHLOG_ENTERFN(a) |
|
54 #define PUSHLOG_LEAVEFN(a) |
|
55 #define PUSHLOG_WRITE(a) |
|
56 #define PUSHLOG_WRITE_FORMAT(a,b) |
|
57 #define PUSHLOG_WRITE_FORMAT2(a,b,c) |
|
58 #define PUSHLOG_WRITE_TIMESTAMP(a) |
|
59 #define PUSHLOG_HEXDUMP(aBuf) |
|
60 // Guard "log-only" argument name with this (expands to nothing). |
|
61 #define LOG_ONLY( argName ) |
|
62 |
|
63 // |
|
64 #endif // __TEST_LOG__ |
|
65 // |
|
66 #endif // PUSHMTMLOG_H |
|
67 |
|
68 // End of File. |