1 /* |
|
2 * Copyright (c) 2001-2009 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 the License "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: Logger utility. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: tr1cfwln#6 % |
|
20 */ |
|
21 |
|
22 #ifndef SECURITYSETTINGSLOGGER_H |
|
23 #define SECURITYSETTINGSLOGGER_H |
|
24 |
|
25 |
|
26 // INCLUDES |
|
27 |
|
28 #include <e32std.h> |
|
29 #include <e32def.h> |
|
30 #include <flogger.h> |
|
31 |
|
32 |
|
33 #ifdef _DEBUG |
|
34 #define __SEC_SETT_LOG__ |
|
35 #endif // _DEBUG |
|
36 |
|
37 |
|
38 #ifdef __SEC_SETT_LOG__ |
|
39 |
|
40 // CONSTANTS |
|
41 |
|
42 // SecuritySettingsLogger logging directory. |
|
43 _LIT( KSecSettLogDir, "TestSecSett" ); |
|
44 // SecSett log file name. |
|
45 _LIT( KSecSettLogFile, "SecSett.log" ); |
|
46 // Format string: enter function. |
|
47 _LIT( KSecSettLogEnterFn, "-> %S" ); |
|
48 // Format string: leave function. |
|
49 _LIT( KSecSettLogLeaveFn, "<- %S" ); |
|
50 // Format string: time. |
|
51 _LIT( KSecSettLogTimeFormatString, "%H:%T:%S:%*C2" ); |
|
52 // Format string: timestamp. |
|
53 _LIT( KSecSettLogTimeStampFormatString, "%S %S" ); |
|
54 |
|
55 // DEFINES |
|
56 |
|
57 // Write log: enter function. |
|
58 #define CLOG_ENTERFN( a ) \ |
|
59 { \ |
|
60 _LIT( temp, a ); \ |
|
61 RFileLogger::WriteFormat \ |
|
62 ( \ |
|
63 KSecSettLogDir, \ |
|
64 KSecSettLogFile, \ |
|
65 EFileLoggingModeAppend, \ |
|
66 KSecSettLogEnterFn, \ |
|
67 &temp \ |
|
68 ); \ |
|
69 } |
|
70 |
|
71 // Write log: leave function. |
|
72 #define CLOG_LEAVEFN( a ) \ |
|
73 { \ |
|
74 _LIT( temp, a ); \ |
|
75 RFileLogger::WriteFormat \ |
|
76 ( \ |
|
77 KSecSettLogDir, \ |
|
78 KSecSettLogFile, \ |
|
79 EFileLoggingModeAppend, \ |
|
80 KSecSettLogLeaveFn, \ |
|
81 &temp \ |
|
82 ); \ |
|
83 } |
|
84 |
|
85 // Write log: string 'a'. |
|
86 #define CLOG_WRITE( a ) \ |
|
87 { \ |
|
88 _LIT( temp, a ); \ |
|
89 RFileLogger::Write \ |
|
90 ( \ |
|
91 KSecSettLogDir, \ |
|
92 KSecSettLogFile, \ |
|
93 EFileLoggingModeAppend, \ |
|
94 temp \ |
|
95 ); \ |
|
96 } |
|
97 |
|
98 // Write log: formatted. |
|
99 #define CLOG_WRITE_FORMAT( a, b ) \ |
|
100 { \ |
|
101 _LIT( temp, a ); \ |
|
102 RFileLogger::WriteFormat \ |
|
103 ( \ |
|
104 KSecSettLogDir, \ |
|
105 KSecSettLogFile, \ |
|
106 EFileLoggingModeAppend, \ |
|
107 temp, \ |
|
108 b \ |
|
109 ); \ |
|
110 } |
|
111 |
|
112 // Write log: timestamp. |
|
113 #define CLOG_WRITE_TIMESTAMP( a ) \ |
|
114 { \ |
|
115 _LIT( temp, a ); \ |
|
116 TTime time; \ |
|
117 time.HomeTime(); \ |
|
118 TBuf<32> timeBuf; \ |
|
119 TRAPD( err, time.FormatL( timeBuf, KSecSettLogTimeFormatString ) ); \ |
|
120 if ( !err ) \ |
|
121 { \ |
|
122 RFileLogger::WriteFormat \ |
|
123 ( \ |
|
124 KSecSettLogDir, \ |
|
125 KSecSettLogFile, \ |
|
126 EFileLoggingModeAppend, \ |
|
127 KSecSettLogTimeStampFormatString, \ |
|
128 &temp, \ |
|
129 &timeBuf \ |
|
130 ); \ |
|
131 } \ |
|
132 } |
|
133 |
|
134 #else // not defined __SEC_SETT_LOG__ |
|
135 |
|
136 // DEFINES |
|
137 |
|
138 // Empty definition (disable log). |
|
139 #define CLOG_ENTERFN( a ) |
|
140 |
|
141 // Empty definition (disable log). |
|
142 #define CLOG_LEAVEFN( a ) |
|
143 |
|
144 // Empty definition (disable log). |
|
145 #define CLOG_WRITE( a ) |
|
146 |
|
147 // Empty definition (disable log). |
|
148 #define CLOG_WRITE_FORMAT( a, b ) |
|
149 |
|
150 // Empty definition (disable log). |
|
151 #define CLOG_WRITE_TIMESTAMP( a ) |
|
152 |
|
153 #endif // __SEC_SETT_LOG__ |
|
154 |
|
155 #endif |
|