1 /* |
|
2 * Copyright (c) 2006-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: Logging utility for MC Photos |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // CLASS HEADER |
|
20 #include "mullogger.h" |
|
21 |
|
22 // EXTERNAL INCLUDES |
|
23 #include <e32debug.h> |
|
24 //#include <flogger.h> |
|
25 |
|
26 // INTERNAL INCLUDES |
|
27 //#include "mullogchunk.h" |
|
28 |
|
29 namespace MulLogger |
|
30 { |
|
31 /// constants |
|
32 const TInt KMaxLoggingBufferLength = 256; |
|
33 |
|
34 |
|
35 /** |
|
36 * TDes overflow handler |
|
37 * Default overflow handler panics and we dont want to do |
|
38 * that in logging so need to implement our own handler. |
|
39 */ |
|
40 class TDes8OverFlowHandler : public TDes8Overflow |
|
41 { |
|
42 public: // from TDes8Overflow |
|
43 /// @ref TDes8Overflow::Overflow |
|
44 void Overflow( TDes8& /*aDes*/ ) |
|
45 { |
|
46 // do nothing, we cant allocate so just eat the error |
|
47 } |
|
48 }; |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // MulLogger::WriteFormat |
|
52 // ----------------------------------------------------------------------------- |
|
53 EXPORT_C void WriteFormat( TRefByValue< const TDesC8 > aFmt, ... ) |
|
54 { |
|
55 /// writeable buffer, in emulator this is in stack |
|
56 TBuf8< KMaxLoggingBufferLength > gWriteBuffer; |
|
57 // take the ellipsis parameter |
|
58 VA_LIST args; |
|
59 VA_START( args, aFmt ); |
|
60 // create overflow handler |
|
61 TDes8OverFlowHandler overflowhandler; |
|
62 // clear old data by setting length to zero |
|
63 gWriteBuffer.SetLength( 0 ); |
|
64 // append the parameters to the descriptor |
|
65 gWriteBuffer.AppendFormatList( aFmt, args, &overflowhandler ); |
|
66 // end the ellipsis handling |
|
67 VA_END( args ); |
|
68 |
|
69 TBuf16<256> buffer; |
|
70 buffer.Copy(gWriteBuffer); |
|
71 RDebug::Print(_L("MUL:-%S"),&buffer); |
|
72 |
|
73 } // namespace |
|
74 |
|
75 } // namespace |
|