|
1 /* |
|
2 * Copyright (c) 2008-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32debug.h> |
|
20 |
|
21 NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow |
|
22 { |
|
23 public: |
|
24 void Overflow(TDes8& /*aDes*/) {} |
|
25 }; |
|
26 |
|
27 NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow |
|
28 { |
|
29 public: |
|
30 void Overflow(TDes16& /*aDes*/) {} |
|
31 }; |
|
32 |
|
33 |
|
34 _LIT8(KStifTestPrefix8, "[STIF_LOG] "); |
|
35 _LIT(KStifTestPrefix, "[STIF_LOG] "); |
|
36 |
|
37 const TInt KMaxLogLineLength = 512; |
|
38 |
|
39 #define TRACE_INFO(p) { Trace p; } |
|
40 |
|
41 void CUSBUiApiTest::Trace(TRefByValue<const TDesC8> aFmt, ...) |
|
42 { |
|
43 VA_LIST list; |
|
44 VA_START(list, aFmt); |
|
45 TOverflowTruncate8 overflow; |
|
46 RBuf8 buf8; |
|
47 buf8.Create( KMaxLogLineLength ); |
|
48 buf8.Append( KStifTestPrefix8 ); |
|
49 buf8.AppendFormatList(aFmt, list, &overflow); |
|
50 |
|
51 RBuf16 buf16; |
|
52 buf16.Create( KMaxLogLineLength ); |
|
53 buf16.Copy(buf8); |
|
54 TRefByValue<const TDesC> tmpFmt(_L("%S")); |
|
55 RDebug::Print(tmpFmt, &buf16); |
|
56 iLog->Log(tmpFmt, &buf16); |
|
57 buf8.Close(); |
|
58 buf16.Close(); |
|
59 }; |
|
60 |
|
61 void CUSBUiApiTest::Trace(TRefByValue<const TDesC16> aFmt, ...) |
|
62 { |
|
63 VA_LIST list; |
|
64 VA_START(list,aFmt); |
|
65 RBuf16 theFinalString; |
|
66 theFinalString.Create( KMaxLogLineLength ); |
|
67 theFinalString.Append( KStifTestPrefix ); |
|
68 TOverflowTruncate16 overflow; |
|
69 theFinalString.AppendFormatList(aFmt,list,&overflow); |
|
70 RDebug::Print(theFinalString); |
|
71 iLog->Log(theFinalString); |
|
72 theFinalString.Close(); |
|
73 }; |