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