|
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef __PUSHLOG_H__ |
|
23 #define __PUSHLOG_H__ |
|
24 |
|
25 |
|
26 /** |
|
27 Logs a literal string specified in a, assuming iLog is an MWapPushLog object. |
|
28 */ |
|
29 #define __LOG_ALWAYS(a) {_LIT(name,a); iLog.WPLPrintf(name);} |
|
30 |
|
31 /** |
|
32 Logs a literal string specified in a, assuming iLog is a pointer to a MWapPushLog |
|
33 object. |
|
34 */ |
|
35 #define __LOG_PTR_ALWAYS(a) {_LIT(name,a); if(iLog) iLog->WPLPrintf(name);} |
|
36 |
|
37 /** |
|
38 Logs a literal string specified in a, assuming aLog is a MWapPushLog object. |
|
39 */ |
|
40 #define __LOG_PAR_ALWAYS(a) {_LIT(name,a); aLog.WPLPrintf(name);} |
|
41 |
|
42 /** |
|
43 Logs an error descriptor and integer error code specified in name and a respectively, |
|
44 assuming iLog is a MWapPushLog object. |
|
45 */ |
|
46 #define __LOG_ERROR_ALWAYS(a,b) {_LIT(name,a); iLog.WPLLogError(name,b);} |
|
47 |
|
48 |
|
49 #if defined(_DEBUG) |
|
50 /** |
|
51 Logs, in debug builds only, a literal string specified in a, assuming iLog |
|
52 is an MWapPushLog object. |
|
53 */ |
|
54 #define __LOG_DEBUG(a) __LOG_ALWAYS(a) |
|
55 |
|
56 /** |
|
57 Logs, in debug builds only, a literal string specified in a, assuming iLog |
|
58 is a pointer to a MWapPushLog object. |
|
59 */ |
|
60 #define __LOG_PTR_DEBUG(a) __LOG_PTR_ALWAYS(a) |
|
61 |
|
62 /** |
|
63 Logs, in debug builds only, a literal string specified in a, assuming aLog |
|
64 is a MWapPushLog object. |
|
65 */ |
|
66 #define __LOG_PAR_DEBUG(a) __LOG_PAR_ALWAYS(a) |
|
67 |
|
68 /** |
|
69 Logs, in debug builds only, a CPushMessage specified in a, assuming iLog is |
|
70 an MWapPushLog object. |
|
71 */ |
|
72 #define __LOG_MSG_DEBUG(a) iLog.WPLPrintfL(a) |
|
73 |
|
74 /** |
|
75 Logs, in debug builds only, an error descriptor and integer error code specified |
|
76 in name and a respectively, assuming iLog is a MWapPushLog object. |
|
77 */ |
|
78 #define __LOG_ERROR_DEBUG(a,b) __LOG_ERROR_ALWAYS(a,b) |
|
79 #else |
|
80 /** Logs always. iLog is an MWapPushLog object*/ |
|
81 #define __LOG_DEBUG(a) |
|
82 /** Logs always. iLog is an MWapPushLog pointer*/ |
|
83 #define __LOG_PTR_DEBUG(a) |
|
84 /** Logs always. iLog is an MWapPushLog object*/ |
|
85 #define __LOG_PAR_DEBUG(a) |
|
86 /** Logs always. iLog is CPushMessage specified in MWapPushLog object*/ |
|
87 #define __LOG_MSG_DEBUG(a) |
|
88 /** Logs error in debug mode */ |
|
89 #define __LOG_ERROR_DEBUG(a,b) |
|
90 |
|
91 |
|
92 #endif |
|
93 |
|
94 |
|
95 class CPushMessage; |
|
96 |
|
97 |
|
98 /** |
|
99 Abstract WAP Push log access interface: logging is primarily for debugging. |
|
100 |
|
101 The standard Symbian OS WAP Push watcher component writes to a log at c:\\logs\\watcher\\watcher.txt |
|
102 if the c:\\logs\\watcher\\ directory exists. It supplies this interface to push |
|
103 plug-ins through CPushHandlerBase::SetLogger(). The plug-in can then call |
|
104 the interface's functions to add its own messages to the log. |
|
105 |
|
106 @publishedPartner |
|
107 @released |
|
108 */ |
|
109 class MWapPushLog |
|
110 { |
|
111 public: |
|
112 /** |
|
113 Writes a string to the log. |
|
114 |
|
115 @param aDescription |
|
116 String to log |
|
117 */ |
|
118 virtual void WPLPrintf(const TDesC& aDescription)=0; |
|
119 |
|
120 /** |
|
121 Writes a push message to the log. |
|
122 |
|
123 It writes the message's content-type, date, expiry, and application-ID headers |
|
124 as text, and the complete headers and message body in binary form. |
|
125 |
|
126 @param aMessage |
|
127 Push message to log |
|
128 */ |
|
129 virtual void WPLPrintfL(CPushMessage& aMessage)=0; |
|
130 |
|
131 /** |
|
132 Writes a binary buffer to the log. |
|
133 |
|
134 The buffer is written as six hexadecimal bytes per line: e.g. |
|
135 |
|
136 @code |
|
137 AB CD 01 12 34 A2 |
|
138 FF 00 AB CD 12 DE |
|
139 @endcode |
|
140 |
|
141 @param aDescription |
|
142 Binary buffer to log |
|
143 */ |
|
144 virtual void WPLLogBinaryAsHex(const TDesC& aDescription)=0; |
|
145 |
|
146 /** |
|
147 Writes an error message and code to the log. |
|
148 |
|
149 @param aDescription |
|
150 Error message |
|
151 |
|
152 @param aError |
|
153 Error code |
|
154 */ |
|
155 virtual void WPLLogError(const TDesC& aDescription,TInt aError)=0; |
|
156 }; |
|
157 |
|
158 |
|
159 #endif |