|
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 /* |
|
24 ------------------------------------------------------------------------------- |
|
25 |
|
26 Class: TDesLoggerOverflowHandler |
|
27 |
|
28 Method: TDesLoggerOverflowHandler |
|
29 |
|
30 Description: Default constructor |
|
31 |
|
32 Parameters: CStifLoggerBase* aLogger: in: Pointer to CStifLoggerBase object |
|
33 TInt aOverFlowSource: in: Over flow source |
|
34 |
|
35 Return Values: None |
|
36 |
|
37 Errors/Exceptions: None |
|
38 |
|
39 Status: Approved |
|
40 |
|
41 ------------------------------------------------------------------------------- |
|
42 */ |
|
43 TDesLoggerOverflowHandler::TDesLoggerOverflowHandler( CStifLoggerBase* aLogger, |
|
44 TInt aOverFlowSource ) |
|
45 { |
|
46 iLogger = aLogger; |
|
47 iOverFlowSource = aOverFlowSource; |
|
48 |
|
49 } |
|
50 |
|
51 |
|
52 /* |
|
53 ------------------------------------------------------------------------------- |
|
54 |
|
55 Class: TDesLoggerOverflowHandler |
|
56 |
|
57 Method: Overflow |
|
58 |
|
59 Description: Simple overflow handling(16 bit) |
|
60 |
|
61 Parameters: TDes16 &aDes: in: Reference to over flow data |
|
62 |
|
63 Return Values: None |
|
64 |
|
65 Errors/Exceptions: None |
|
66 |
|
67 Status: Approved |
|
68 |
|
69 ------------------------------------------------------------------------------- |
|
70 */ |
|
71 void TDesLoggerOverflowHandler::Overflow( TDes16& aDes ) |
|
72 { |
|
73 __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) ); |
|
74 |
|
75 // If overflow |
|
76 TInt len( 0 ); |
|
77 len = aDes.Length(); |
|
78 |
|
79 // const TInt to TInt avoiding warnings |
|
80 TInt maxLogData = KMaxLogData; |
|
81 TInt maxTestFileName = KMaxFileName; |
|
82 |
|
83 // Overflow: Log() without aStyle or Log() with aStyle |
|
84 if ( ( iOverFlowSource == 1 || iOverFlowSource == 2 ) |
|
85 && maxLogData > 60 ) |
|
86 { |
|
87 // Log overflow info if info is in allowed limits |
|
88 aDes[len-2] = 13; // 13 or '\' in Symbian OS |
|
89 aDes[len-1] = 10; // 10 or 'n' in Symbian OS |
|
90 // ~60 |
|
91 iLogger->Send( 0, _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!") ); |
|
92 } |
|
93 // Overflow: WriteDelimiter() |
|
94 if ( iOverFlowSource == 3 && maxLogData > 70 ) |
|
95 { |
|
96 // Log overflow info if info is in allowed limits, ~70 |
|
97 iLogger->Send( 0, _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ) ); |
|
98 } |
|
99 // Overflow: StartHtmlPage() |
|
100 if ( iOverFlowSource == 4 && maxTestFileName > 70 ) |
|
101 { |
|
102 // Log overflow info if info is in allowed limits, ~70 |
|
103 iLogger->Send( 0, _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ) ); |
|
104 } |
|
105 |
|
106 } |
|
107 |
|
108 /* |
|
109 ------------------------------------------------------------------------------- |
|
110 |
|
111 Class: TDes8OverflowHandler |
|
112 |
|
113 Method: TDes8LoggerOverflowHandler |
|
114 |
|
115 Description: Default constructor |
|
116 |
|
117 Parameters: CStifLoggerBase* aLogger: in: Pointer to CStifLoggerBase object |
|
118 TInt aOverFlowSource: in: Over flow source |
|
119 |
|
120 Return Values: None |
|
121 |
|
122 Errors/Exceptions: None |
|
123 |
|
124 Status: Approved |
|
125 |
|
126 ------------------------------------------------------------------------------- |
|
127 */ |
|
128 TDes8LoggerOverflowHandler::TDes8LoggerOverflowHandler( CStifLoggerBase* aLogger, |
|
129 TInt aOverFlowSource ) |
|
130 { |
|
131 iLogger = aLogger; |
|
132 iOverFlowSource = aOverFlowSource; |
|
133 |
|
134 } |
|
135 |
|
136 /* |
|
137 ------------------------------------------------------------------------------- |
|
138 |
|
139 Class: TDes8LoggerOverflowHandler |
|
140 |
|
141 Method: Overflow |
|
142 |
|
143 Description: Simple overflow handling(8 bit) |
|
144 |
|
145 Parameters: TDes8 &aDes: in: Reference to over flow data |
|
146 |
|
147 Return Values: None |
|
148 |
|
149 Errors/Exceptions: None |
|
150 |
|
151 Status: Approved |
|
152 |
|
153 ------------------------------------------------------------------------------- |
|
154 */ |
|
155 void TDes8LoggerOverflowHandler::Overflow( TDes8& aDes ) |
|
156 { |
|
157 __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) ); |
|
158 |
|
159 // If overflow |
|
160 TInt len( 0 ); |
|
161 len = aDes.Length(); |
|
162 |
|
163 // const TInt to TInt avoiding warnings |
|
164 TInt maxLogData = KMaxLogData; |
|
165 TInt maxTestFileName = KMaxFileName; |
|
166 |
|
167 // Overflow: Log() without aStyle or Log() with aStyle |
|
168 if ( ( iOverFlowSource == 1 || iOverFlowSource == 2 ) |
|
169 && maxLogData > 60 ) |
|
170 { |
|
171 // Log overflow info if info is in allowed limits |
|
172 aDes[len-2] = 13; // 13 or '\' in Symbian OS |
|
173 aDes[len-1] = 10; // 10 or 'n' in Symbian OS |
|
174 // ~60 |
|
175 iLogger->Send( 0, _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!") ); |
|
176 } |
|
177 // Overflow: WriteDelimiter() |
|
178 if ( iOverFlowSource == 3 && maxLogData > 70 ) |
|
179 { |
|
180 // Log overflow info if info is in allowed limits, ~70 |
|
181 iLogger->Send( 0, _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ) ); |
|
182 } |
|
183 // Overflow: StartHtmlPage() |
|
184 if ( iOverFlowSource == 4 && maxTestFileName > 70 ) |
|
185 { |
|
186 // Log overflow info if info is in allowed limits, ~70 |
|
187 iLogger->Send( 0, _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ) ); |
|
188 } |
|
189 |
|
190 } |
|
191 |
|
192 // End of File |