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