williamr@2: // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef __PUSHLOG_H__ williamr@2: #define __PUSHLOG_H__ williamr@2: williamr@2: williamr@2: /** williamr@2: Logs a literal string specified in a, assuming iLog is an MWapPushLog object. williamr@2: */ williamr@2: #define __LOG_ALWAYS(a) {_LIT(name,a); iLog.WPLPrintf(name);} williamr@2: williamr@2: /** williamr@2: Logs a literal string specified in a, assuming iLog is a pointer to a MWapPushLog williamr@2: object. williamr@2: */ williamr@2: #define __LOG_PTR_ALWAYS(a) {_LIT(name,a); if(iLog) iLog->WPLPrintf(name);} williamr@2: williamr@2: /** williamr@2: Logs a literal string specified in a, assuming aLog is a MWapPushLog object. williamr@2: */ williamr@2: #define __LOG_PAR_ALWAYS(a) {_LIT(name,a); aLog.WPLPrintf(name);} williamr@2: williamr@2: /** williamr@2: Logs an error descriptor and integer error code specified in name and a respectively, williamr@2: assuming iLog is a MWapPushLog object. williamr@2: */ williamr@2: #define __LOG_ERROR_ALWAYS(a,b) {_LIT(name,a); iLog.WPLLogError(name,b);} williamr@2: williamr@2: williamr@2: #if defined(_DEBUG) williamr@2: /** williamr@2: Logs, in debug builds only, a literal string specified in a, assuming iLog williamr@2: is an MWapPushLog object. williamr@2: */ williamr@2: #define __LOG_DEBUG(a) __LOG_ALWAYS(a) williamr@2: williamr@2: /** williamr@2: Logs, in debug builds only, a literal string specified in a, assuming iLog williamr@2: is a pointer to a MWapPushLog object. williamr@2: */ williamr@2: #define __LOG_PTR_DEBUG(a) __LOG_PTR_ALWAYS(a) williamr@2: williamr@2: /** williamr@2: Logs, in debug builds only, a literal string specified in a, assuming aLog williamr@2: is a MWapPushLog object. williamr@2: */ williamr@2: #define __LOG_PAR_DEBUG(a) __LOG_PAR_ALWAYS(a) williamr@2: williamr@2: /** williamr@2: Logs, in debug builds only, a CPushMessage specified in a, assuming iLog is williamr@2: an MWapPushLog object. williamr@2: */ williamr@2: #define __LOG_MSG_DEBUG(a) iLog.WPLPrintfL(a) williamr@2: williamr@2: /** williamr@2: Logs, in debug builds only, an error descriptor and integer error code specified williamr@2: in name and a respectively, assuming iLog is a MWapPushLog object. williamr@2: */ williamr@2: #define __LOG_ERROR_DEBUG(a,b) __LOG_ERROR_ALWAYS(a,b) williamr@2: #else williamr@2: /** Logs always. iLog is an MWapPushLog object*/ williamr@2: #define __LOG_DEBUG(a) williamr@2: /** Logs always. iLog is an MWapPushLog pointer*/ williamr@2: #define __LOG_PTR_DEBUG(a) williamr@2: /** Logs always. iLog is an MWapPushLog object*/ williamr@2: #define __LOG_PAR_DEBUG(a) williamr@2: /** Logs always. iLog is CPushMessage specified in MWapPushLog object*/ williamr@2: #define __LOG_MSG_DEBUG(a) williamr@2: /** Logs error in debug mode */ williamr@2: #define __LOG_ERROR_DEBUG(a,b) williamr@2: williamr@2: williamr@2: #endif williamr@2: williamr@2: williamr@2: class CPushMessage; williamr@2: williamr@2: williamr@2: /** williamr@2: Abstract WAP Push log access interface: logging is primarily for debugging. williamr@2: williamr@2: The standard Symbian OS WAP Push watcher component writes to a log at c:\\logs\\watcher\\watcher.txt williamr@2: if the c:\\logs\\watcher\\ directory exists. It supplies this interface to push williamr@2: plug-ins through CPushHandlerBase::SetLogger(). The plug-in can then call williamr@2: the interface's functions to add its own messages to the log. williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: class MWapPushLog williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Writes a string to the log. williamr@2: williamr@2: @param aDescription williamr@2: String to log williamr@2: */ williamr@2: virtual void WPLPrintf(const TDesC& aDescription)=0; williamr@2: williamr@2: /** williamr@2: Writes a push message to the log. williamr@2: williamr@2: It writes the message's content-type, date, expiry, and application-ID headers williamr@2: as text, and the complete headers and message body in binary form. williamr@2: williamr@2: @param aMessage williamr@2: Push message to log williamr@2: */ williamr@2: virtual void WPLPrintfL(CPushMessage& aMessage)=0; williamr@2: williamr@2: /** williamr@2: Writes a binary buffer to the log. williamr@2: williamr@2: The buffer is written as six hexadecimal bytes per line: e.g. williamr@2: williamr@2: @code williamr@2: AB CD 01 12 34 A2 williamr@2: FF 00 AB CD 12 DE williamr@2: @endcode williamr@2: williamr@2: @param aDescription williamr@2: Binary buffer to log williamr@2: */ williamr@2: virtual void WPLLogBinaryAsHex(const TDesC& aDescription)=0; williamr@2: williamr@2: /** williamr@2: Writes an error message and code to the log. williamr@2: williamr@2: @param aDescription williamr@2: Error message williamr@2: williamr@2: @param aError williamr@2: Error code williamr@2: */ williamr@2: virtual void WPLLogError(const TDesC& aDescription,TInt aError)=0; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif