|
1 /* |
|
2 * Copyright (c) 2002 - 2004 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: |
|
15 * Logging macros for Scheme Dispatcher. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef SCHEME_DISP_LOGGER_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <e32def.h> |
|
27 #ifdef __SCHEMEDISP_LOG__ |
|
28 #include <flogger.h> |
|
29 |
|
30 /// Scheme logging directory. |
|
31 _LIT( KSchemeLogDir, "Scheme" ); |
|
32 /// Scheme log file name. |
|
33 _LIT( KSchemeLogFile, "SchemePlugin.txt" ); |
|
34 /// Format string: enter function. |
|
35 _LIT( KSchemeLogEnterFn, "-> %S" ); |
|
36 /// Format string: leave function. |
|
37 _LIT( KSchemeLogLeaveFn, "<- %S" ); |
|
38 /// Format string: time. |
|
39 _LIT( KSchemeLogTimeFormatString, "%H:%T:%S:%*C2" ); |
|
40 /// Format string: timestamp. |
|
41 _LIT( KSchemeLogTimeStampFormatString, "%S %S" ); |
|
42 |
|
43 /// Write log: enter function. |
|
44 #define CLOG_ENTERFN( a ) \ |
|
45 { \ |
|
46 _LIT( temp, a ); \ |
|
47 RFileLogger::WriteFormat \ |
|
48 ( \ |
|
49 KSchemeLogDir, \ |
|
50 KSchemeLogFile, \ |
|
51 EFileLoggingModeAppend, \ |
|
52 KSchemeLogEnterFn, \ |
|
53 &temp \ |
|
54 ); \ |
|
55 } |
|
56 |
|
57 /// Write log: leave function. |
|
58 #define CLOG_LEAVEFN( a ) \ |
|
59 { \ |
|
60 _LIT( temp, a ); \ |
|
61 RFileLogger::WriteFormat \ |
|
62 ( \ |
|
63 KSchemeLogDir, \ |
|
64 KSchemeLogFile, \ |
|
65 EFileLoggingModeAppend, \ |
|
66 KSchemeLogLeaveFn, \ |
|
67 &temp \ |
|
68 ); \ |
|
69 } |
|
70 |
|
71 /// Write log: string 'a'. |
|
72 #define CLOG_WRITE( a ) \ |
|
73 { \ |
|
74 _LIT( temp, a ); \ |
|
75 RFileLogger::Write \ |
|
76 ( \ |
|
77 KSchemeLogDir, \ |
|
78 KSchemeLogFile, \ |
|
79 EFileLoggingModeAppend, \ |
|
80 temp \ |
|
81 ); \ |
|
82 } |
|
83 |
|
84 /// Write log: formatted. |
|
85 #define CLOG_WRITE_FORMAT( a, b ) \ |
|
86 { \ |
|
87 _LIT( temp, a ); \ |
|
88 RFileLogger::WriteFormat \ |
|
89 ( \ |
|
90 KSchemeLogDir, \ |
|
91 KSchemeLogFile, \ |
|
92 EFileLoggingModeAppend, \ |
|
93 temp, \ |
|
94 b \ |
|
95 ); \ |
|
96 } |
|
97 |
|
98 /// Write log: timestamp. |
|
99 #define CLOG_WRITE_TIMESTAMP( a ) \ |
|
100 { \ |
|
101 _LIT( temp, a ); \ |
|
102 TTime time; \ |
|
103 time.HomeTime(); \ |
|
104 TBuf<32> timeBuf; \ |
|
105 TRAPD( err, time.FormatL( timeBuf, KSchemeLogTimeFormatString ) ); \ |
|
106 if ( !err ) \ |
|
107 { \ |
|
108 RFileLogger::WriteFormat \ |
|
109 ( \ |
|
110 KSchemeLogDir, \ |
|
111 KSchemeLogFile, \ |
|
112 EFileLoggingModeAppend, \ |
|
113 KSchemeLogTimeStampFormatString, \ |
|
114 &temp, \ |
|
115 &timeBuf \ |
|
116 ); \ |
|
117 } \ |
|
118 } |
|
119 |
|
120 #else /* not defined __TEST_SCHEME_DISP_DEBUG */ |
|
121 |
|
122 /// Empty definition (disable log). |
|
123 #define CLOG_ENTERFN( a ) |
|
124 |
|
125 /// Empty definition (disable log). |
|
126 #define CLOG_LEAVEFN( a ) |
|
127 |
|
128 /// Empty definition (disable log). |
|
129 #define CLOG_WRITE( a ) |
|
130 |
|
131 /// Empty definition (disable log). |
|
132 #define CLOG_WRITE_FORMAT( a, b ) |
|
133 |
|
134 /// Empty definition (disable log). |
|
135 #define CLOG_WRITE_TIMESTAMP( a ) |
|
136 |
|
137 #endif /* def __SCHEMEDISP_LOG__ */ |
|
138 |
|
139 #endif /* def SCHEME_DISP_LOGGER_H */ |