1 /* |
|
2 * Copyright (c) 2009 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: This module contains implementation of CDataLogger |
|
15 * class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32std.h> |
|
21 #include "DataLogger.h" |
|
22 #include "Output.h" |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 // None |
|
26 |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 // None |
|
29 |
|
30 // CONSTANTS |
|
31 // None |
|
32 |
|
33 // MACROS |
|
34 // None |
|
35 |
|
36 // LOCAL CONSTANTS AND MACROS |
|
37 // None |
|
38 |
|
39 // MODULE DATA STRUCTURES |
|
40 // None |
|
41 |
|
42 // LOCAL FUNCTION PROTOTYPES |
|
43 // None |
|
44 |
|
45 // FORWARD DECLARATIONS |
|
46 // None |
|
47 |
|
48 // ==================== LOCAL FUNCTIONS ======================================= |
|
49 // None |
|
50 |
|
51 |
|
52 // ================= MEMBER FUNCTIONS ========================================= |
|
53 |
|
54 /* |
|
55 ------------------------------------------------------------------------------- |
|
56 |
|
57 Class: CDataLogger |
|
58 |
|
59 Method: CDataLogger |
|
60 |
|
61 Description: Default constructor |
|
62 |
|
63 C++ default constructor can NOT contain any code, that |
|
64 might leave. |
|
65 |
|
66 Parameters: COutput* output: in: Output source |
|
67 |
|
68 Return Values: None |
|
69 |
|
70 Errors/Exceptions: None |
|
71 |
|
72 Status: Approved |
|
73 |
|
74 ------------------------------------------------------------------------------- |
|
75 */ |
|
76 CDataLogger::CDataLogger( COutput* output ) |
|
77 { |
|
78 iOutput = output; |
|
79 } |
|
80 |
|
81 /* |
|
82 ------------------------------------------------------------------------------- |
|
83 |
|
84 Class: CDataLogger |
|
85 |
|
86 Method: ConstructL |
|
87 |
|
88 Description: Symbian OS second phase constructor |
|
89 |
|
90 Symbian OS default constructor can leave. |
|
91 |
|
92 Parameters: None |
|
93 |
|
94 Return Values: None |
|
95 |
|
96 Errors/Exceptions: None |
|
97 |
|
98 Status: Approved |
|
99 |
|
100 ------------------------------------------------------------------------------- |
|
101 */ |
|
102 void CDataLogger::ConstructL() |
|
103 { |
|
104 |
|
105 } |
|
106 |
|
107 /* |
|
108 ------------------------------------------------------------------------------- |
|
109 |
|
110 Class: CDataLogger |
|
111 |
|
112 Method: NewL |
|
113 |
|
114 Description: Two-phased constructor. |
|
115 |
|
116 Parameters: const TDesC& aTestPath: in: Log path |
|
117 const TDesC& aTestFile: in: Log filename |
|
118 TLoggerType aLoggerType: in: File type |
|
119 TOutput aOutput: in: Output source |
|
120 TBool aOverWrite: in: For file overwrite |
|
121 TBool aWithTimeStamp: in: For timestamp |
|
122 TBool aWithLineBreak: in: For line break |
|
123 TBool aWithEventRanking: in: For events ranking to file |
|
124 TBool aThreadIdToLogFile: in: Indicator to thread id adding to |
|
125 end of the log file |
|
126 TBool aCreateLogDir: in: Indicator to directory creation |
|
127 TInt aStaticBufferSize |
|
128 TBool aUnicode: not used: Indicator if file has to be in unicode format. |
|
129 |
|
130 Return Values: CDataLogger*: pointer to CDataLogger object |
|
131 |
|
132 Errors/Exceptions: Leaves if called COutput::NewL method fails |
|
133 |
|
134 Status: Proposal |
|
135 |
|
136 ------------------------------------------------------------------------------- |
|
137 */ |
|
138 CDataLogger* CDataLogger::NewL( const TDesC& aTestPath, |
|
139 const TDesC& aTestFile, |
|
140 TLoggerType aLoggerType, |
|
141 TOutput aOutput, |
|
142 TBool aOverWrite, |
|
143 TBool aWithTimeStamp, |
|
144 TBool aWithLineBreak, |
|
145 TBool aWithEventRanking, |
|
146 TBool aThreadIdToLogFile, |
|
147 TBool aCreateLogDir, |
|
148 TInt aStaticBufferSize, |
|
149 TBool /*aUnicode*/ ) |
|
150 { |
|
151 __TRACE( KInfo, ( _L( "STIFLOGGER: Creating data logger" ) ) ); |
|
152 |
|
153 aWithTimeStamp = EFalse; // Time stamp not allowed in data logging |
|
154 aWithLineBreak = EFalse; // Line break not allowed in data logging |
|
155 aWithEventRanking = EFalse; // Event ranking not allowed in data logging |
|
156 |
|
157 TBool aUnicode(EFalse); //For data type unicode is not allowed |
|
158 // Create COutput object output |
|
159 COutput* output = COutput::NewL( aTestPath, |
|
160 aTestFile, |
|
161 aLoggerType, |
|
162 aOutput, |
|
163 aOverWrite, |
|
164 aWithTimeStamp, |
|
165 aWithLineBreak, |
|
166 aWithEventRanking, |
|
167 aThreadIdToLogFile, |
|
168 aCreateLogDir, |
|
169 aStaticBufferSize, |
|
170 aUnicode ); |
|
171 |
|
172 CleanupStack::PushL( output ); |
|
173 |
|
174 __ASSERT_ALWAYS( output != NULL, User::Leave( KErrNotFound ) ); |
|
175 // Create CDataLogger object dataLogger and bind to COutput |
|
176 CDataLogger* dataLogger = new (ELeave) CDataLogger( output ); |
|
177 // DATA logger owns output object and it will be destroyed in STIFLogger |
|
178 // destructor. |
|
179 CleanupStack::Pop( output ); |
|
180 |
|
181 CleanupStack::PushL( dataLogger ); |
|
182 dataLogger->ConstructL(); |
|
183 CleanupStack::Pop( dataLogger ); |
|
184 |
|
185 |
|
186 return dataLogger; |
|
187 |
|
188 } |
|
189 |
|
190 /* |
|
191 ------------------------------------------------------------------------------- |
|
192 |
|
193 Class: CDataLogger |
|
194 |
|
195 Method: ~CDataLogger |
|
196 |
|
197 Description: Destructor |
|
198 |
|
199 Parameters: None |
|
200 |
|
201 Return Values: None |
|
202 |
|
203 Errors/Exceptions: None |
|
204 |
|
205 Status: Approved |
|
206 |
|
207 ------------------------------------------------------------------------------- |
|
208 */ |
|
209 CDataLogger::~CDataLogger() |
|
210 { |
|
211 } |
|
212 |
|
213 /* |
|
214 ------------------------------------------------------------------------------- |
|
215 |
|
216 Class: CDataLogger |
|
217 |
|
218 Method: Send |
|
219 |
|
220 Description: Send style information and 16 bit data to the output module. |
|
221 |
|
222 Parameters: TInt TStyle: in: Text forming |
|
223 const TDesC& aData: in: Data to be logged |
|
224 |
|
225 Return Values: TInt: Symbian error code. |
|
226 |
|
227 Errors/Exceptions: None |
|
228 |
|
229 Status: Approved |
|
230 |
|
231 ------------------------------------------------------------------------------- |
|
232 */ |
|
233 TInt CDataLogger::Send( TInt /*TStyle*/, const TDesC& aData ) |
|
234 { |
|
235 // No text styling implemented |
|
236 return iOutput->Write( EFalse, ETrue, EFalse, aData ); |
|
237 |
|
238 } |
|
239 |
|
240 /* |
|
241 ------------------------------------------------------------------------------- |
|
242 |
|
243 Class: CDataLogger |
|
244 |
|
245 Method: Send |
|
246 |
|
247 Description: Send style information and 8 bit data to the output module. |
|
248 |
|
249 Parameters: TInt TStyle: in: Text forming |
|
250 const TDesC8& aData: in: Data to be logged |
|
251 |
|
252 Return Values: TInt: Symbian error code. |
|
253 |
|
254 Errors/Exceptions: None |
|
255 |
|
256 Status: Approved |
|
257 |
|
258 ------------------------------------------------------------------------------- |
|
259 */ |
|
260 TInt CDataLogger::Send( TInt /*TStyle*/, const TDesC8& aData ) |
|
261 { |
|
262 // No text styling implemented |
|
263 return iOutput->Write( EFalse, ETrue, ETrue, aData ); |
|
264 |
|
265 } |
|
266 |
|
267 // ================= OTHER EXPORTED FUNCTIONS ================================= |
|
268 // None |
|
269 |
|
270 // End of File |
|