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