1 /* |
|
2 * Copyright (c) 2002-2010 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 #ifndef __TFLOGGER_H__ |
|
20 #define __TFLOGGER_H__ |
|
21 |
|
22 #include <flogger.h> |
|
23 #include <e32svr.h> |
|
24 |
|
25 _LIT(KTfLogFolder, "ussd"); |
|
26 _LIT(KTfLogFile, "ussdeditor.txt"); |
|
27 |
|
28 /** |
|
29 * ------------------------------------------------------------------------------ |
|
30 * |
|
31 * Remove #define LOGGING_ENABLED from comments to enable logging |
|
32 * |
|
33 * ------------------------------------------------------------------------------ |
|
34 */ |
|
35 |
|
36 #ifdef _DEBUG |
|
37 #define LOGGING_ENABLED |
|
38 #endif |
|
39 |
|
40 /** |
|
41 * ------------------------------------------------------------------------------ |
|
42 * |
|
43 * LOGGING MACROs |
|
44 * |
|
45 * USE THESE MACROS IN YOUR CODE |
|
46 * |
|
47 * Example: TFLOGTEXT(own_desc) |
|
48 * Example: TFLOGSTRING("Test") |
|
49 * Example: TFLOGSTRING("Test %i", aValue) |
|
50 * Example: TFLOGSTRING("Test %i %i", aValue1, aValue2) |
|
51 * |
|
52 * ------------------------------------------------------------------------------ |
|
53 */ |
|
54 |
|
55 #ifdef LOGGING_ENABLED |
|
56 |
|
57 #define TFLOGTEXT(TEXT) \ |
|
58 { \ |
|
59 RFileLogger::Write(KTfLogFolder,KTfLogFile, \ |
|
60 EFileLoggingModeAppend, TEXT); \ |
|
61 RDebug::Print(TEXT); \ |
|
62 } |
|
63 |
|
64 #define TFLOGSTRING(TEXT) \ |
|
65 { \ |
|
66 _LIT(tempLogDes, TEXT); \ |
|
67 RFileLogger::Write(\ |
|
68 KTfLogFolder, \ |
|
69 KTfLogFile, \ |
|
70 EFileLoggingModeAppend, \ |
|
71 tempLogDes()); \ |
|
72 RDebug::Print(_L(TEXT)); \ |
|
73 } |
|
74 |
|
75 #define TFLOGSTRING2(TEXT, VAR1) \ |
|
76 { \ |
|
77 _LIT(tempLogDes, TEXT); \ |
|
78 RFileLogger::WriteFormat(\ |
|
79 KTfLogFolder, \ |
|
80 KTfLogFile, \ |
|
81 EFileLoggingModeAppend, \ |
|
82 TRefByValue<const TDesC>(tempLogDes()), VAR1); \ |
|
83 RDebug::Print(_L(TEXT), VAR1); \ |
|
84 } |
|
85 |
|
86 #define TFLOGSTRING3(TEXT, VAR1, VAR2) \ |
|
87 { \ |
|
88 _LIT(tempLogDes, TEXT); \ |
|
89 RFileLogger::WriteFormat(\ |
|
90 KTfLogFolder, \ |
|
91 KTfLogFile, \ |
|
92 EFileLoggingModeAppend, \ |
|
93 TRefByValue<const TDesC>(tempLogDes()), VAR1, VAR2); \ |
|
94 RDebug::Print(_L(TEXT), VAR1, VAR2); \ |
|
95 } |
|
96 |
|
97 #else |
|
98 |
|
99 #define TFLOGTEXT(TEXT) |
|
100 #define TFLOGSTRING(TEXT) |
|
101 #define TFLOGSTRING2(TEXT, VAR1) |
|
102 #define TFLOGSTRING3(TEXT, VAR1, VAR2) |
|
103 |
|
104 #endif // LOGGING_ENABLED |
|
105 |
|
106 #endif // __TFLOGGER_H__ |
|