|
1 /* |
|
2 * Copyright (c) 2005, 2006 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 file defines logging macros for USB Class |
|
15 * Change UI |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef USBCLASSCHANGEUIDEBUG_H |
|
21 #define USBCLASSCHANGEUIDEBUG_H |
|
22 |
|
23 #ifdef _DEBUG |
|
24 |
|
25 #include <e32svr.h> |
|
26 #include <e32std.h> |
|
27 |
|
28 // =========================================================================== |
|
29 #ifdef __WINS__ // File logging for WINS |
|
30 // =========================================================================== |
|
31 |
|
32 //The curly braces and the usual semicolon after the macro call cause |
|
33 //a harmless extra null statement. |
|
34 #define FLOG(a) { FPrint(a); } |
|
35 #define FTRACE(a) { a; } |
|
36 |
|
37 #include <f32file.h> |
|
38 #include <flogger.h> |
|
39 |
|
40 _LIT(KLogFile,"usbclasschangeuilog.txt"); |
|
41 _LIT(KLogDir,"USBUI"); |
|
42 |
|
43 //Declare the FPrint function with variable number of arguments. |
|
44 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...) |
|
45 { |
|
46 VA_LIST list; |
|
47 VA_START(list,aFmt); |
|
48 RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, |
|
49 aFmt, list); |
|
50 } |
|
51 |
|
52 // =========================================================================== |
|
53 #else // RDebug logging for target HW |
|
54 // =========================================================================== |
|
55 #define FLOG(a) { RDebug::Print(a); } |
|
56 #define FTRACE(a) { a; } |
|
57 |
|
58 //Debug message printing function with variable number of arguments. |
|
59 inline void FPrint(const TRefByValue<const TDesC16> aFmt, ...) |
|
60 { |
|
61 VA_LIST list; |
|
62 VA_START(list,aFmt); |
|
63 TInt tmpInt = VA_ARG(list, TInt); |
|
64 TInt tmpInt2 = VA_ARG(list, TInt); |
|
65 TInt tmpInt3 = VA_ARG(list, TInt); |
|
66 VA_END(list); |
|
67 RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); |
|
68 } |
|
69 |
|
70 //Debug message printing function with variable number of arguments. |
|
71 inline void FPrint(TRefByValue<const TDesC8> aFmt, ...) |
|
72 { |
|
73 |
|
74 VA_LIST list; |
|
75 VA_START(list, aFmt); |
|
76 TBuf8<256> buf8; |
|
77 buf8.AppendFormatList(aFmt, list); |
|
78 |
|
79 TBuf16<256> buf16(buf8.Length()); |
|
80 buf16.Copy(buf8); |
|
81 |
|
82 TRefByValue<const TDesC> tmpFmt(_L("%S")); |
|
83 RDebug::Print(tmpFmt, &buf16); |
|
84 } |
|
85 |
|
86 #endif //__WINS__ |
|
87 |
|
88 // =========================================================================== |
|
89 #else // // No loggings --> Reduced binary size |
|
90 // =========================================================================== |
|
91 #define FLOG(a) |
|
92 #define FTRACE(a) |
|
93 |
|
94 #endif // _DEBUG |
|
95 |
|
96 |
|
97 #endif // USBCLASSCHANGEUIDEBUG_H |
|
98 |
|
99 // End of File |