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