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