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