|
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: |
|
15 * Central place for nice debug-type macros & functions |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef _SRCS_DEBUG_H |
|
21 #define _SRCS_DEBUG_H |
|
22 |
|
23 #ifdef _DEBUG |
|
24 |
|
25 // Enable this to enable memory tracing |
|
26 // to SRCS |
|
27 //#define MEMTRACE |
|
28 |
|
29 // Following define is to enable OOM |
|
30 // situations in SRCS |
|
31 // NOTE! SHOULD NEVER BE IN RELEASES |
|
32 //#define TEST_OOM |
|
33 |
|
34 #ifdef __WINS__ |
|
35 |
|
36 // File logging for WIS |
|
37 #define __FLOGGING__ |
|
38 |
|
39 #else |
|
40 |
|
41 // Logging with RDebug for target HW |
|
42 #define __CLOGGING__ |
|
43 //#define __FLOGGING__ |
|
44 |
|
45 |
|
46 #endif //__WINS__ |
|
47 |
|
48 #endif |
|
49 |
|
50 #if defined ( __FLOGGING__ ) |
|
51 |
|
52 _LIT(KLogFile,"Srcslog.txt"); |
|
53 _LIT(KLogDir,"SRCS"); |
|
54 |
|
55 #include <f32file.h> |
|
56 #include <flogger.h> |
|
57 |
|
58 #define FLOG(a) {FPrint(a);} |
|
59 |
|
60 #define FLOGHEX(value, len) {RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len);} |
|
61 |
|
62 #define FTRACE(a) {a;} |
|
63 // Declare the FPrint function |
|
64 |
|
65 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...) |
|
66 { |
|
67 VA_LIST list; |
|
68 VA_START(list,aFmt); |
|
69 RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); |
|
70 } |
|
71 |
|
72 inline void FHex(const TUint8* aPtr, TInt aLen) |
|
73 { |
|
74 RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); |
|
75 } |
|
76 |
|
77 inline void FHex(const TDesC8& aDes) |
|
78 { |
|
79 FHex(aDes.Ptr(), aDes.Length()); |
|
80 } |
|
81 |
|
82 // RDebug logging |
|
83 #elif defined(__CLOGGING__) |
|
84 |
|
85 #include <e32svr.h> |
|
86 |
|
87 #define FLOG(a) {RDebug::Print(a);} |
|
88 |
|
89 #define FLOGHEX(a) |
|
90 |
|
91 #define FTRACE(a) {a;} |
|
92 |
|
93 // Declare the FPrint function |
|
94 |
|
95 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...) |
|
96 { |
|
97 VA_LIST list; |
|
98 VA_START(list,aFmt); |
|
99 TInt tmpInt = VA_ARG(list, TInt); |
|
100 TInt tmpInt2 = VA_ARG(list, TInt); |
|
101 TInt tmpInt3 = VA_ARG(list, TInt); |
|
102 VA_END(list); |
|
103 RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); |
|
104 } |
|
105 |
|
106 |
|
107 #else // No loggings --> reduced code size |
|
108 #define FLOG(a) |
|
109 #define FLOGHEX(a) |
|
110 #define FTRACE(a) |
|
111 |
|
112 #endif //_DEBUG |
|
113 |
|
114 #endif // SRCS_DEBUG_H |