|
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 UI Notifiers |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef USBUINOTIFDEBUG_H |
|
20 #define USBUINOTIFDEBUG_H |
|
21 |
|
22 #ifdef _DEBUG |
|
23 |
|
24 #include <e32svr.h> |
|
25 #include <e32std.h> |
|
26 |
|
27 // =========================================================================== |
|
28 #ifdef __WINS__ // File logging for WINS |
|
29 // =========================================================================== |
|
30 #define FLOG(a) { FPrint(a); } |
|
31 #define FTRACE(a) { a; } |
|
32 |
|
33 #include <f32file.h> |
|
34 #include <flogger.h> |
|
35 |
|
36 _LIT(KLogFile,"usbuinotiflog.txt"); |
|
37 _LIT(KLogDir,"USBUI"); |
|
38 |
|
39 // Declare the FPrint function |
|
40 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...) |
|
41 { |
|
42 VA_LIST list; |
|
43 VA_START(list,aFmt); |
|
44 RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, |
|
45 aFmt, list); |
|
46 } |
|
47 |
|
48 |
|
49 // =========================================================================== |
|
50 #else // Target HW |
|
51 // =========================================================================== |
|
52 |
|
53 // =========================================================================== |
|
54 #ifdef _USBUINOTIF_FILE_LOGGING_ // File logging for target HW |
|
55 // =========================================================================== |
|
56 |
|
57 #define FLOG(a) { FPrint(a); } |
|
58 #define FTRACE(a) { a; } |
|
59 |
|
60 #include <f32file.h> |
|
61 #include <flogger.h> |
|
62 |
|
63 _LIT(KLogFile,"usbuinotiflog.txt"); |
|
64 _LIT(KLogDir,"USBUI"); |
|
65 |
|
66 // Declare the FPrint function |
|
67 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...) |
|
68 { |
|
69 VA_LIST list; |
|
70 VA_START(list,aFmt); |
|
71 RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, |
|
72 aFmt, list); |
|
73 } |
|
74 |
|
75 // =========================================================================== |
|
76 #else // RDebug logging for target HW |
|
77 // =========================================================================== |
|
78 #define FLOG(a) { RDebug::Print(a); } |
|
79 #define FTRACE(a) { a; } |
|
80 |
|
81 //Declare the FPrint function with variable number of arguments. |
|
82 inline void FPrint(const TRefByValue<const TDesC16> aFmt, ...) |
|
83 { |
|
84 VA_LIST list; |
|
85 VA_START(list,aFmt); |
|
86 TInt tmpInt = VA_ARG(list, TInt); |
|
87 TInt tmpInt2 = VA_ARG(list, TInt); |
|
88 TInt tmpInt3 = VA_ARG(list, TInt); |
|
89 VA_END(list); |
|
90 RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); |
|
91 } |
|
92 |
|
93 //Declare the FPrint function with variable number of arguments. |
|
94 inline void FPrint(TRefByValue<const TDesC8> aFmt, ...) |
|
95 { |
|
96 |
|
97 VA_LIST list; |
|
98 VA_START(list, aFmt); |
|
99 TBuf8<256> buf8; |
|
100 buf8.AppendFormatList(aFmt, list); |
|
101 |
|
102 TBuf16<256> buf16(buf8.Length()); |
|
103 buf16.Copy(buf8); |
|
104 |
|
105 TRefByValue<const TDesC> tmpFmt(_L("%S")); |
|
106 RDebug::Print(tmpFmt, &buf16); |
|
107 } |
|
108 #endif //_USBUINOTIF_FILE_LOGGING_ |
|
109 #endif // __WINS__ |
|
110 |
|
111 // =========================================================================== |
|
112 #else // // No loggings --> Reduced binary size |
|
113 // =========================================================================== |
|
114 #define FLOG(a) |
|
115 #define FTRACE(a) |
|
116 |
|
117 #endif // _DEBUG |
|
118 |
|
119 |
|
120 #endif // USBUINOTIFDEBUG_H |
|
121 |
|
122 // End of File |