|
1 /* |
|
2 * Copyright (c) 2007 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: Logging macros |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __SSYNC_LOGGER_H__ |
|
20 #define __SSYNC_LOGGER_H__ |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32def.h> |
|
24 |
|
25 #include <flogger.h> |
|
26 |
|
27 #undef __LOGGING__ |
|
28 |
|
29 /// Logging directory. |
|
30 _LIT( KLogDir, "mcs" ); |
|
31 /// Log file name. |
|
32 _LIT( KLogFile, "mcs.txt" ); |
|
33 /// Format string: enter function. |
|
34 _LIT( KLogEnterFn, "-> %S" ); |
|
35 /// Format string: leave function. |
|
36 _LIT( KLogLeaveFn, "<- %S" ); |
|
37 /// Format string: time. |
|
38 _LIT( KLogTimeFormatString, "%H:%T:%S:%*C2" ); |
|
39 /// Format string: timestamp. |
|
40 _LIT( KLogTimeStampFormatString, "%S %S" ); |
|
41 |
|
42 #ifdef __LOGGING__ |
|
43 |
|
44 #pragma message("Logging is enabled") |
|
45 |
|
46 #include <flogger.h> |
|
47 |
|
48 /// Write log: enter function. |
|
49 #define CLOG_ENTERFN( a ) \ |
|
50 { \ |
|
51 _LIT( temp, a ); \ |
|
52 RFileLogger::WriteFormat \ |
|
53 ( \ |
|
54 KLogDir, \ |
|
55 KLogFile, \ |
|
56 EFileLoggingModeAppend, \ |
|
57 KLogEnterFn, \ |
|
58 &temp \ |
|
59 ); \ |
|
60 } |
|
61 |
|
62 /// Write log: leave function. |
|
63 #define CLOG_LEAVEFN( a ) \ |
|
64 { \ |
|
65 _LIT( temp, a ); \ |
|
66 RFileLogger::WriteFormat \ |
|
67 ( \ |
|
68 KLogDir, \ |
|
69 KLogFile, \ |
|
70 EFileLoggingModeAppend, \ |
|
71 KLogLeaveFn, \ |
|
72 &temp \ |
|
73 ); \ |
|
74 } |
|
75 |
|
76 /// Write log: string 'a'. |
|
77 #define CLOG_WRITE( a ) \ |
|
78 { \ |
|
79 _LIT( temp, a ); \ |
|
80 RFileLogger::Write \ |
|
81 ( \ |
|
82 KLogDir, \ |
|
83 KLogFile, \ |
|
84 EFileLoggingModeAppend, \ |
|
85 temp \ |
|
86 ); \ |
|
87 } |
|
88 |
|
89 /// Write log: formatted. |
|
90 #define CLOG_WRITE_FORMAT( a, b... ) \ |
|
91 { \ |
|
92 _LIT( temp, a ); \ |
|
93 RFileLogger::WriteFormat \ |
|
94 ( \ |
|
95 KLogDir, \ |
|
96 KLogFile, \ |
|
97 EFileLoggingModeAppend, \ |
|
98 temp, \ |
|
99 b \ |
|
100 ); \ |
|
101 } |
|
102 |
|
103 #define CLOG_WRITE_FORMAT8( a, b... ) \ |
|
104 { \ |
|
105 _LIT8( temp, a ); \ |
|
106 RFileLogger::WriteFormat \ |
|
107 ( \ |
|
108 KLogDir, \ |
|
109 KLogFile, \ |
|
110 EFileLoggingModeAppend, \ |
|
111 temp, \ |
|
112 b \ |
|
113 ); \ |
|
114 } |
|
115 |
|
116 #else /* not defined __LOGGING__ */ |
|
117 |
|
118 /// Empty definition (disable log). |
|
119 #define CLOG_ENTERFN( a... ) |
|
120 |
|
121 /// Empty definition (disable log). |
|
122 #define CLOG_LEAVEFN( a... ) |
|
123 |
|
124 /// Empty definition (disable log). |
|
125 #define CLOG_WRITE( a... ) |
|
126 |
|
127 /// Empty definition (disable log). |
|
128 #define CLOG_WRITE_FORMAT( a... ) |
|
129 |
|
130 /// Empty definition (disable log). |
|
131 #define CLOG_WRITE_FORMAT8( a... ) |
|
132 |
|
133 #endif /* def __LOGGING__ */ |
|
134 |
|
135 #endif // __SSYNC_LOGGER_H__ |
|
136 |