|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * Logging macros for APControl List Plugin |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef APCONROL_LIST_PLUGIN_LOGGER_H |
|
21 #define APCONROL_LIST_PLUGIN_LOGGER_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #ifdef _DEBUG |
|
26 #include <e32std.h> |
|
27 #include <e32def.h> |
|
28 #include <flogger.h> |
|
29 |
|
30 // TYPES |
|
31 |
|
32 enum TAPControlListPluginLogMask ///< Log mask bits. |
|
33 { |
|
34 ELogOff = 0x00000000, ///< Don't log. |
|
35 EApUi = 0x00000001, ///< Log transaction activity. |
|
36 ESelector = 0x00000002, ///< Log Selection activity. |
|
37 EEditing = 0x00000004, ///< Log editing activity. |
|
38 EModel = 0x00000008, ///< Log model activity. |
|
39 |
|
40 EProtection = 0x00000020, ///< Log protection activity. |
|
41 EApItem = 0x00000040, ///< Log ApItem activity. |
|
42 ECommons = 0x00000080, ///< Log transaction activity. |
|
43 EActiveDb = 0x000000F0, ///< Log active db¬ific. activity. |
|
44 ELogAll = 0xFFFFFFFF ///< Log all. |
|
45 }; |
|
46 |
|
47 // MACROS |
|
48 |
|
49 /// Determines what to log. Construct this from TApEngineLogMask values. |
|
50 #define APCONTROL_LIST_LOG_MASK ELogAll |
|
51 /// Determines log detail (0==basic level). |
|
52 #define APCONTROL_LIST_LOG_LEVEL 4 |
|
53 |
|
54 // CLASS DECLARATION |
|
55 |
|
56 /** |
|
57 * Logger class. |
|
58 */ |
|
59 NONSHARABLE_CLASS( APControlListPluginLogger ) |
|
60 { |
|
61 public: // new methods |
|
62 |
|
63 /** |
|
64 * Write formatted log. |
|
65 * @param aMask Log mask. |
|
66 * @param aLevel Log level. |
|
67 * @param aFmt Format string. |
|
68 */ |
|
69 static void Write |
|
70 ( TInt32 aMask, TInt aLevel, |
|
71 TRefByValue<const TDesC16> aFmt, ... ); |
|
72 |
|
73 /** |
|
74 * Write formatted log. |
|
75 * @param aMask Log mask. |
|
76 * @param aLevel Log level. |
|
77 * @param aFmt Format string. |
|
78 * @param aList Variable argument list. |
|
79 */ |
|
80 static void Write |
|
81 ( |
|
82 TInt32 aMask, |
|
83 TInt aLevel, |
|
84 TRefByValue<const TDesC16> aFmt, |
|
85 VA_LIST& aList |
|
86 ); |
|
87 |
|
88 /** |
|
89 * Write formatted log. |
|
90 * @param aMask Log mask. |
|
91 * @param aLevel Log level. |
|
92 * @param aFmt Format string. |
|
93 */ |
|
94 static void Write |
|
95 ( TInt32 aMask, TInt aLevel, |
|
96 TRefByValue<const TDesC8> aFmt, ... ); |
|
97 |
|
98 /** |
|
99 * Write formatted log. |
|
100 * @param aMask Log mask. |
|
101 * @param aLevel Log level. |
|
102 * @param aFmt Format string. |
|
103 * @param aList Variable argument list. |
|
104 */ |
|
105 static void Write |
|
106 ( |
|
107 TInt32 aMask, |
|
108 TInt aLevel, |
|
109 TRefByValue<const TDesC8> aFmt, |
|
110 VA_LIST& aList |
|
111 ); |
|
112 |
|
113 /** |
|
114 * Write hex dump. |
|
115 * @param aMask Log mask. |
|
116 * @param aLevel Log level. |
|
117 * @param aHeader Header string. |
|
118 * @param aMargin Margin. |
|
119 * @param aPtr Data. |
|
120 * @param aLen Data length. |
|
121 */ |
|
122 static void HexDump |
|
123 ( |
|
124 TInt32 aMask, |
|
125 TInt aLevel, |
|
126 const TText* aHeader, |
|
127 const TText* aMargin, |
|
128 const TUint8* aPtr, |
|
129 TInt aLen |
|
130 ); |
|
131 |
|
132 /** |
|
133 * Create log dir. |
|
134 */ |
|
135 static void FCreate(); |
|
136 }; |
|
137 |
|
138 |
|
139 #define CLOG_CREATE() {APControlListPluginLogger::FCreate();} |
|
140 /// Write formatted to log. |
|
141 #define CLOG( body ) APControlListPluginLogger::Write body |
|
142 /// Write hex dump. |
|
143 #define CDUMP( body ) APControlListPluginLogger::HexDump body |
|
144 |
|
145 #else /* not defined _DEBUG */ |
|
146 |
|
147 /// Do nothing (log disabled). |
|
148 #define CLOG( body ) |
|
149 /// Do nothing (log disabled). |
|
150 #define CDUMP( body ) |
|
151 #define CLOG_CREATE() |
|
152 |
|
153 #endif /* def _DEBUG */ |
|
154 |
|
155 #endif /* def APCONROL_LIST_PLUGIN_LOGGER_H */ |