|
1 /* |
|
2 * Copyright (c) 2007 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: Implement inline functions for the CameseLog module |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <E32SVR.H> |
|
21 |
|
22 // ---------------------------------------------------------------------------- |
|
23 // Write a string to the log - 16 bit version |
|
24 // ---------------------------------------------------------------------------- |
|
25 // |
|
26 inline void CameseLog::Printf1(const TDesC& aFmt) |
|
27 { |
|
28 TInt msgSize = aFmt.Length(); |
|
29 TInt offSet = 0; |
|
30 TPtrC msgPtr; |
|
31 while(offSet < msgSize) |
|
32 { |
|
33 msgPtr.Set(aFmt.Mid(offSet)); |
|
34 RFileLogger::WriteFormat(KCameseLogFolder(), KCameseLogFile(), |
|
35 EFileLoggingModeAppend, msgPtr.Left(100)); |
|
36 offSet += 100; //set to 100 |
|
37 }; |
|
38 RDebug::Print(aFmt); |
|
39 } |
|
40 |
|
41 // ---------------------------------------------------------------------------- |
|
42 // Write a multiple argument list to the log - 16 bit version |
|
43 // ---------------------------------------------------------------------------- |
|
44 // |
|
45 inline void CameseLog::Printf(TRefByValue<const TDesC> aFmt,...) |
|
46 { |
|
47 VA_LIST list; |
|
48 VA_START(list,aFmt); |
|
49 RFileLogger::WriteFormat(KCameseLogFolder(), KCameseLogFile(), |
|
50 EFileLoggingModeAppend, aFmt, list); |
|
51 TLogOverflowHandler overflow; |
|
52 TBuf<KLogBufferSize> tmpBuf; |
|
53 tmpBuf.AppendFormatList(aFmt, list, &overflow); |
|
54 RDebug::Print(tmpBuf); |
|
55 VA_END(list); |
|
56 } |
|
57 |
|
58 // ---------------------------------------------------------------------------- |
|
59 // Write a string to the log - 8 bit version |
|
60 // ---------------------------------------------------------------------------- |
|
61 // |
|
62 inline void CameseLog::Printf1(const TDesC8& aFmt) |
|
63 { |
|
64 TInt msgSize = aFmt.Length(); |
|
65 TInt offSet = 0; |
|
66 TPtrC8 msgPtr; |
|
67 while(offSet < msgSize) |
|
68 { |
|
69 msgPtr.Set(aFmt.Mid(offSet)); |
|
70 RFileLogger::WriteFormat(KCameseLogFolder(), KCameseLogFile(), |
|
71 EFileLoggingModeAppend, msgPtr.Left(100)); |
|
72 offSet += 100; //set to 100 |
|
73 }; |
|
74 |
|
75 HBufC* buf16 = HBufC::NewLC(aFmt.Length()); |
|
76 buf16->Des().Copy(aFmt); |
|
77 RDebug::Print(*buf16); |
|
78 CleanupStack::PopAndDestroy(buf16); |
|
79 } |
|
80 |
|
81 // ---------------------------------------------------------------------------- |
|
82 // Write a multiple argument list to the log - 8 bit version |
|
83 // ---------------------------------------------------------------------------- |
|
84 // |
|
85 inline void CameseLog::Printf(TRefByValue<const TDesC8> aFmt,...) |
|
86 { |
|
87 VA_LIST list; |
|
88 VA_START(list,aFmt); |
|
89 RFileLogger::WriteFormat(KCameseLogFolder(), KCameseLogFile(), |
|
90 EFileLoggingModeAppend, aFmt, list); |
|
91 |
|
92 TLogOverflowHandler8 overflow; |
|
93 TBuf8<KLogBufferSize> tmpBuf; |
|
94 tmpBuf.AppendFormatList(aFmt, list, &overflow); |
|
95 |
|
96 HBufC* buf16 = HBufC::NewLC(tmpBuf.Length()); |
|
97 buf16->Des().Copy(tmpBuf); |
|
98 RDebug::Print(*buf16); |
|
99 CleanupStack::PopAndDestroy(buf16); |
|
100 |
|
101 VA_END(list); |
|
102 } |
|
103 |
|
104 // ---------------------------------------------------------------------------- |
|
105 // Write a hex dump to the log |
|
106 // ---------------------------------------------------------------------------- |
|
107 // |
|
108 inline void CameseLog::HexDump( |
|
109 const TText* aHeader, |
|
110 const TText* aMargin, |
|
111 const TUint8* aPtr, |
|
112 TInt aLen) |
|
113 { |
|
114 // Hex Dumps only to file. |
|
115 RFileLogger::HexDump(KCameseLogFolder(), KCameseLogFile(), EFileLoggingModeAppend, |
|
116 aHeader, aMargin, aPtr, aLen); |
|
117 } |
|
118 |
|
119 // ---------------------------------------------------------------------------- |
|
120 // Handle overflow without rising a panic |
|
121 // ---------------------------------------------------------------------------- |
|
122 // |
|
123 inline void TLogOverflowHandler::Overflow(TDes16& /*aDes*/) |
|
124 { |
|
125 return; |
|
126 } |
|
127 |
|
128 inline void TLogOverflowHandler8::Overflow(TDes8& /*aDes*/) |
|
129 { |
|
130 return; |
|
131 } |
|
132 |