|
1 /* |
|
2 * Copyright (c) 2004 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( KPnpLogFolder, "PnP" ); |
|
38 _LIT( KPnpLogFile, "PnPUtil.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 _LIT( KTextFormat, "%S%S" ); |
|
60 _LIT( KPnpUtil, "PnpUtil| " ); |
|
61 |
|
62 #define INTRLOGTEXT( AAA ) \ |
|
63 { \ |
|
64 RFileLogger::Write( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, AAA ); \ |
|
65 } |
|
66 #define INTRLOGSTRING( AAA ) \ |
|
67 { \ |
|
68 _LIT( tempLogDes, AAA ); \ |
|
69 RFileLogger::Write( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, tempLogDes() ); \ |
|
70 } |
|
71 // 20 chars is left for the formatted item |
|
72 #define INTRLOGSTRING2( AAA, BBB ) \ |
|
73 { \ |
|
74 _LIT( tempLogDes, AAA ); \ |
|
75 RFileLogger::WriteFormat( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB ); \ |
|
76 } |
|
77 // 40 chars is left for the formatted items |
|
78 #define INTRLOGSTRING3( AAA, BBB, CCC ) \ |
|
79 { \ |
|
80 _LIT( tempLogDes, AAA ); \ |
|
81 RFileLogger::WriteFormat( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB, CCC ); \ |
|
82 } |
|
83 #else |
|
84 #define INTRLOGTEXT( AAA ) |
|
85 #define INTRLOGSTRING( AAA ) |
|
86 #define INTRLOGSTRING2( AAA, BBB ) |
|
87 #define INTRLOGSTRING3( AAA, BBB, CCC ) |
|
88 #endif |
|
89 |
|
90 /* |
|
91 ----------------------------------------------------------------------------- |
|
92 |
|
93 EXTERNAL MACROs |
|
94 |
|
95 USE THESE MACROS IN YOUR CODE ! |
|
96 |
|
97 ----------------------------------------------------------------------------- |
|
98 */ |
|
99 |
|
100 |
|
101 #define LOGTEXT( AAA ) { \ |
|
102 INTRLOGTEXT( AAA ); \ |
|
103 } // Example: LOGTEXT( own_desc ); |
|
104 |
|
105 #define LOGSTRING( AAA ) { \ |
|
106 INTRLOGSTRING( AAA ); \ |
|
107 } // Example: LOGSTRING( "Test" ); |
|
108 |
|
109 #define LOGSTRING2( AAA, BBB ) { \ |
|
110 INTRLOGSTRING2( AAA, BBB ); \ |
|
111 } // Example: LOGSTRING( "Test %i", aValue ); |
|
112 |
|
113 #define LOGSTRING3( AAA, BBB, CCC ) { \ |
|
114 INTRLOGSTRING3( AAA, BBB, CCC ); \ |
|
115 } // Example: LOGSTRING( "Test %i %i", aValue1, aValue2 ); |
|
116 |
|
117 |
|
118 #else // LOGGING_ENABLED |
|
119 |
|
120 #define LOGTEXT( AAA ) |
|
121 #define LOGSTRING( AAA ) |
|
122 #define LOGSTRING2( AAA, BBB ) |
|
123 #define LOGSTRING3( AAA, BBB, CCC ) |
|
124 |
|
125 #endif // LOGGING_ENABLED |
|
126 |
|
127 // DATA TYPES |
|
128 // None. |
|
129 |
|
130 // FUNCTION PROTOTYPES |
|
131 // None. |
|
132 |
|
133 // FORWARD DECLARATIONS |
|
134 // None. |
|
135 |
|
136 // CLASS DECLARATION |
|
137 // None. |
|
138 |
|
139 #endif // __LOGGER_H__ |