|
1 /* |
|
2 * Copyright (c) 2002-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: Code for getting logs for omacp components. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __LOGGER_H__ |
|
19 #define __LOGGER_H__ |
|
20 |
|
21 #ifdef _DEBUG |
|
22 #define LOGGING_ENABLED |
|
23 #endif |
|
24 #ifdef LOGGING_ENABLED // This must be enabled to use logging system |
|
25 |
|
26 #define LOGGER_LOGGING // Log to Logger |
|
27 |
|
28 |
|
29 |
|
30 #ifdef LOGGER_LOGGING |
|
31 |
|
32 // INCLUDES |
|
33 #include <flogger.h> |
|
34 |
|
35 // LOG SETTINGS |
|
36 _LIT( KProvLogFolder, "Provisioning" ); |
|
37 _LIT( KEmailAdapterLogFile, "EmailAdapter.TXT" ); |
|
38 |
|
39 #endif |
|
40 |
|
41 // CONSTANTS |
|
42 // None. |
|
43 |
|
44 // MACROS |
|
45 /* |
|
46 ----------------------------------------------------------------------------- |
|
47 |
|
48 INTERNAL MACROs. |
|
49 |
|
50 DO NOT USE THESE DIRECTLY !!! |
|
51 SEE EXTERNAL MACROS |
|
52 |
|
53 ----------------------------------------------------------------------------- |
|
54 */ |
|
55 |
|
56 #ifdef LOGGER_LOGGING |
|
57 |
|
58 #define INTRLOGTEXT( AAA ) \ |
|
59 { \ |
|
60 RFileLogger::Write( KProvLogFolder(), KEmailAdapterLogFile(), EFileLoggingModeAppend, AAA ); \ |
|
61 } |
|
62 #define INTRLOGSTRING( AAA ) \ |
|
63 { \ |
|
64 _LIT( tempLogDes, AAA ); \ |
|
65 RFileLogger::Write( KProvLogFolder(), KEmailAdapterLogFile(), EFileLoggingModeAppend, tempLogDes() ); \ |
|
66 } |
|
67 #define INTRLOGSTRING2( AAA, BBB ) \ |
|
68 { \ |
|
69 _LIT( tempLogDes, AAA ); \ |
|
70 RFileLogger::WriteFormat( KProvLogFolder(), KEmailAdapterLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB ); \ |
|
71 } |
|
72 #define INTRLOGSTRING3( AAA, BBB, CCC ) \ |
|
73 { \ |
|
74 _LIT( tempLogDes, AAA ); \ |
|
75 RFileLogger::WriteFormat( KProvLogFolder(), KEmailAdapterLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB, CCC ); \ |
|
76 } |
|
77 #else |
|
78 #define INTRLOGTEXT( AAA ) |
|
79 #define INTRLOGSTRING( AAA ) |
|
80 #define INTRLOGSTRING2( AAA, BBB ) |
|
81 #define INTRLOGSTRING3( AAA, BBB, CCC ) |
|
82 #endif |
|
83 |
|
84 /* |
|
85 ----------------------------------------------------------------------------- |
|
86 |
|
87 EXTERNAL MACROs |
|
88 |
|
89 USE THESE MACROS IN YOUR CODE ! |
|
90 |
|
91 ----------------------------------------------------------------------------- |
|
92 */ |
|
93 |
|
94 |
|
95 #define LOGTEXT( AAA ) { \ |
|
96 INTRLOGTEXT( AAA ); \ |
|
97 } // Example: LOGTEXT( own_desc ); |
|
98 |
|
99 #define LOGSTRING( AAA ) { \ |
|
100 INTRLOGSTRING( AAA ); \ |
|
101 } // Example: LOGSTRING( "Test" ); |
|
102 |
|
103 #define LOGSTRING2( AAA, BBB ) { \ |
|
104 INTRLOGSTRING2( AAA, BBB ); \ |
|
105 } // Example: LOGSTRING( "Test %i", aValue ); |
|
106 |
|
107 #define LOGSTRING3( AAA, BBB, CCC ) { \ |
|
108 INTRLOGSTRING3( AAA, BBB, CCC ); \ |
|
109 } // Example: LOGSTRING( "Test %i %i", aValue1, aValue2 ); |
|
110 |
|
111 |
|
112 #else // LOGGING_ENABLED |
|
113 |
|
114 #define LOGTEXT( AAA ) |
|
115 #define LOGSTRING( AAA ) |
|
116 #define LOGSTRING2( AAA, BBB ) |
|
117 #define LOGSTRING3( AAA, BBB, CCC ) |
|
118 |
|
119 #endif // LOGGING_ENABLED |
|
120 |
|
121 // DATA TYPES |
|
122 // None. |
|
123 |
|
124 // FUNCTION PROTOTYPES |
|
125 // None. |
|
126 |
|
127 // FORWARD DECLARATIONS |
|
128 // None. |
|
129 |
|
130 // CLASS DECLARATION |
|
131 // None. |
|
132 |
|
133 #endif // __LOGGER_H__ |
|
134 |
|
135 // End of File |