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 |
|
15 * TDesLoggerOverflowHandler class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32std.h> |
|
21 #include "LoggerOverFlow.h" |
|
22 |
|
23 // EXTERNAL DATA STRUCTURES |
|
24 // None |
|
25 |
|
26 // EXTERNAL FUNCTION PROTOTYPES |
|
27 // None |
|
28 |
|
29 // CONSTANTS |
|
30 // None |
|
31 |
|
32 // MACROS |
|
33 // None |
|
34 |
|
35 // LOCAL CONSTANTS AND MACROS |
|
36 // None |
|
37 |
|
38 // MODULE DATA STRUCTURES |
|
39 // None |
|
40 |
|
41 // LOCAL FUNCTION PROTOTYPES |
|
42 // None |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 // None |
|
46 |
|
47 // ==================== LOCAL FUNCTIONS ======================================= |
|
48 // None |
|
49 |
|
50 // ================= MEMBER FUNCTIONS ========================================= |
|
51 |
|
52 /* |
|
53 ------------------------------------------------------------------------------- |
|
54 |
|
55 Class: TDesLoggerOverflowHandler |
|
56 |
|
57 Method: TDesLoggerOverflowHandler |
|
58 |
|
59 Description: Default constructor |
|
60 |
|
61 Parameters: CStifLogger* aLogger: in: Pointer to CStifLogger object |
|
62 TInt aOverFlowSource: in: Over flow source |
|
63 |
|
64 Return Values: None |
|
65 |
|
66 Errors/Exceptions: None |
|
67 |
|
68 Status: Approved |
|
69 |
|
70 ------------------------------------------------------------------------------- |
|
71 */ |
|
72 TDesLoggerOverflowHandler::TDesLoggerOverflowHandler( CStifLogger* aLogger, |
|
73 TInt aOverFlowSource ) |
|
74 { |
|
75 iLogger = aLogger; |
|
76 iOverFlowSource = aOverFlowSource; |
|
77 |
|
78 } |
|
79 |
|
80 /* |
|
81 ------------------------------------------------------------------------------- |
|
82 |
|
83 Class: TDesLoggerOverflowHandler |
|
84 |
|
85 Method: TDesLoggerOverflowHandler |
|
86 |
|
87 Description: Default constructor |
|
88 |
|
89 Parameters: CRDebugOutput* aRDebugOutput: in: Pointer to CFileOutput object |
|
90 TInt aOverFlowSource: in: Over flow source |
|
91 |
|
92 Return Values: None |
|
93 |
|
94 Errors/Exceptions: None |
|
95 |
|
96 Status: Approved |
|
97 |
|
98 ------------------------------------------------------------------------------- |
|
99 */ |
|
100 // For future needs |
|
101 // TDesLoggerOverflowHandler::TDesLoggerOverflowHandler( |
|
102 // CRDebugOutput* aRDebugOutput, |
|
103 // TInt aOverFlowSource ) |
|
104 // { |
|
105 // iRDebugOutput = aRDebugOutput; |
|
106 // iOverFlowSource = aOverFlowSource; |
|
107 // |
|
108 // } |
|
109 |
|
110 /* |
|
111 ------------------------------------------------------------------------------- |
|
112 |
|
113 Class: TDesLoggerOverflowHandler |
|
114 |
|
115 Method: Overflow |
|
116 |
|
117 Description: Simple overflow handling(16 bit) |
|
118 |
|
119 Parameters: TDes16 &aDes: in: Reference to over flow data |
|
120 |
|
121 Return Values: None |
|
122 |
|
123 Errors/Exceptions: None |
|
124 |
|
125 Status: Approved |
|
126 |
|
127 ------------------------------------------------------------------------------- |
|
128 */ |
|
129 void TDesLoggerOverflowHandler::Overflow( TDes16& aDes ) |
|
130 { |
|
131 __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) ); |
|
132 |
|
133 // If overflow |
|
134 TInt len( 0 ); |
|
135 len = aDes.Length(); |
|
136 |
|
137 // const TInt to TInt avoiding warnings |
|
138 TInt maxLogData = KMaxLogData; |
|
139 TInt maxTestFileName = KMaxFileName; |
|
140 |
|
141 // Overflow: Log() without aStyle or Log() with aStyle |
|
142 if ( ( iOverFlowSource == 1 || iOverFlowSource == 2 ) |
|
143 && maxLogData > 60 ) |
|
144 { |
|
145 // Log overflow info if info is in allowed limits |
|
146 aDes[len-2] = 13; // 13 or '\' in Symbian OS |
|
147 aDes[len-1] = 10; // 10 or 'n' in Symbian OS |
|
148 // ~60 |
|
149 iLogger->Send( 0, _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!") ); |
|
150 } |
|
151 // Overflow: WriteDelimiter() |
|
152 if ( iOverFlowSource == 3 && maxLogData > 70 ) |
|
153 { |
|
154 // Log overflow info if info is in allowed limits, ~70 |
|
155 iLogger->Send( 0, _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ) ); |
|
156 } |
|
157 // Overflow: StartHtmlPage() |
|
158 if ( iOverFlowSource == 4 && maxTestFileName > 70 ) |
|
159 { |
|
160 // Log overflow info if info is in allowed limits, ~70 |
|
161 iLogger->Send( 0, _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ) ); |
|
162 } |
|
163 |
|
164 } |
|
165 |
|
166 /* |
|
167 ------------------------------------------------------------------------------- |
|
168 |
|
169 DESCRIPTION |
|
170 |
|
171 This module contains implementation of TDes8LoggerOverflowHandler class |
|
172 member functions. |
|
173 |
|
174 ------------------------------------------------------------------------------- |
|
175 */ |
|
176 |
|
177 // ================= MEMBER FUNCTIONS ========================================= |
|
178 |
|
179 /* |
|
180 ------------------------------------------------------------------------------- |
|
181 |
|
182 Class: TDes8OverflowHandler |
|
183 |
|
184 Method: TDes8LoggerOverflowHandler |
|
185 |
|
186 Description: Default constructor |
|
187 |
|
188 Parameters: CStifLogger* aLogger: in: Pointer to CStifLogger object |
|
189 TInt aOverFlowSource: in: Over flow source |
|
190 |
|
191 Return Values: None |
|
192 |
|
193 Errors/Exceptions: None |
|
194 |
|
195 Status: Approved |
|
196 |
|
197 ------------------------------------------------------------------------------- |
|
198 */ |
|
199 TDes8LoggerOverflowHandler::TDes8LoggerOverflowHandler( CStifLogger* aLogger, |
|
200 TInt aOverFlowSource ) |
|
201 { |
|
202 iLogger = aLogger; |
|
203 iOverFlowSource = aOverFlowSource; |
|
204 |
|
205 } |
|
206 |
|
207 /* |
|
208 ------------------------------------------------------------------------------- |
|
209 |
|
210 Class: TDes8LoggerOverflowHandler |
|
211 |
|
212 Method: TDes8LoggerOverflowHandler |
|
213 |
|
214 Description: Default constructor |
|
215 |
|
216 Parameters: CRDebugOutput* aRDebugOutput: in: Pointer to CFileOutput object |
|
217 TInt aOverFlowSource: in: Over flow source |
|
218 |
|
219 Return Values: None |
|
220 |
|
221 Errors/Exceptions: None |
|
222 |
|
223 Status: Approved |
|
224 |
|
225 ------------------------------------------------------------------------------- |
|
226 */ |
|
227 // For future needs |
|
228 // TDes8LoggerOverflowHandler::TDes8LoggerOverflowHandler( |
|
229 // CRDebugOutput* aRDebugOutput, |
|
230 // TInt aOverFlowSource ) |
|
231 // { |
|
232 // iRDebugOutput = aRDebugOutput; |
|
233 // iOverFlowSource = aOverFlowSource; |
|
234 |
|
235 // } |
|
236 |
|
237 /* |
|
238 ------------------------------------------------------------------------------- |
|
239 |
|
240 Class: TDes8LoggerOverflowHandler |
|
241 |
|
242 Method: Overflow |
|
243 |
|
244 Description: Simple overflow handling(8 bit) |
|
245 |
|
246 Parameters: TDes8 &aDes: in: Reference to over flow data |
|
247 |
|
248 Return Values: None |
|
249 |
|
250 Errors/Exceptions: None |
|
251 |
|
252 Status: Approved |
|
253 |
|
254 ------------------------------------------------------------------------------- |
|
255 */ |
|
256 void TDes8LoggerOverflowHandler::Overflow( TDes8& aDes ) |
|
257 { |
|
258 __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) ); |
|
259 |
|
260 // If overflow |
|
261 TInt len( 0 ); |
|
262 len = aDes.Length(); |
|
263 |
|
264 // const TInt to TInt avoiding warnings |
|
265 TInt maxLogData = KMaxLogData; |
|
266 TInt maxTestFileName = KMaxFileName; |
|
267 |
|
268 // Overflow: Log() without aStyle or Log() with aStyle |
|
269 if ( ( iOverFlowSource == 1 || iOverFlowSource == 2 ) |
|
270 && maxLogData > 60 ) |
|
271 { |
|
272 // Log overflow info if info is in allowed limits |
|
273 aDes[len-2] = 13; // 13 or '\' in Symbian OS |
|
274 aDes[len-1] = 10; // 10 or 'n' in Symbian OS |
|
275 // ~60 |
|
276 iLogger->Send( 0, _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!") ); |
|
277 } |
|
278 // Overflow: WriteDelimiter() |
|
279 if ( iOverFlowSource == 3 && maxLogData > 70 ) |
|
280 { |
|
281 // Log overflow info if info is in allowed limits, ~70 |
|
282 iLogger->Send( 0, _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ) ); |
|
283 } |
|
284 // Overflow: StartHtmlPage() |
|
285 if ( iOverFlowSource == 4 && maxTestFileName > 70 ) |
|
286 { |
|
287 // Log overflow info if info is in allowed limits, ~70 |
|
288 iLogger->Send( 0, _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ) ); |
|
289 } |
|
290 |
|
291 } |
|
292 |
|
293 // ================= OTHER EXPORTED FUNCTIONS ================================= |
|
294 // None |
|
295 |
|
296 // End of File |
|