sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef PXY_DEBUG_H sl@0: #define PXY_DEBUG_H sl@0: sl@0: // #define _HOST_DEBUG_TRACE_ sl@0: // #define _PROXY_DEBUG_PRINT_ sl@0: // #define _PROXY_FN_TRACE_ sl@0: sl@0: #if defined(_PROXY_FN_TRACE_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) sl@0: #define FUNCTION_TRACE_ENABLED sl@0: #endif sl@0: sl@0: #if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) sl@0: #include sl@0: #endif sl@0: sl@0: #ifdef FUNCTION_TRACE_ENABLED sl@0: /** sl@0: Logging function to be used with static functions. Prints the function string on sl@0: function entry and exit. sl@0: */ sl@0: class TLogStaticFn sl@0: { sl@0: public: sl@0: static const TInt KLogBufferSize = 0xFF; sl@0: sl@0: TLogStaticFn(const TDesC8& aFunctionName); sl@0: sl@0: ~TLogStaticFn(); sl@0: sl@0: protected: sl@0: TBuf8 buf; sl@0: TPtrC8 iFunctionName; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Logging function which prints the function string on function entry and exit. sl@0: */ sl@0: class TLogFn sl@0: { sl@0: public: sl@0: static const TInt KLogBufferSize = 0xFF; sl@0: TLogFn(const TDesC8& aFunctionName, void* aThisPointer); sl@0: sl@0: ~TLogFn(); sl@0: sl@0: private: sl@0: TBuf8 buf; sl@0: TPtrC8 iFunctionName; sl@0: void* iThisPointer; sl@0: }; sl@0: sl@0: #define __MSFNLOG TLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this); sl@0: #define __MSFNSLOG TLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); sl@0: #else // FUNCTION_TRACE_ENABLED sl@0: #define __MSFNSLOG sl@0: #define __MSFNLOG sl@0: #endif // FUNCTION_TRACE_ENABLED sl@0: sl@0: sl@0: #if defined (_PROXY_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) sl@0: #define __PXYPRINT(t) {RDebug::Print(t);} sl@0: #define __PXYPRINT1(t,a) {RDebug::Print(t,a);} sl@0: #define __PXYPRINT2(t,a,b) {RDebug::Print(t,a,b);} sl@0: #define __PXYPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} sl@0: #define __PXYPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} sl@0: #define __PXYPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} sl@0: #define __PXYPRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);} sl@0: #define __PXYPRINT1TEMP(t,a) {TBuftemp(a);RDebug::Print(t,&temp);} sl@0: #else sl@0: #define __PXYPRINT(t) sl@0: #define __PXYPRINT1(t,a) sl@0: #define __PXYPRINT2(t,a,b) sl@0: #define __PXYPRINT3(t,a,b,c) sl@0: #define __PXYPRINT4(t,a,b,c,d) sl@0: #define __PXYPRINT5(t,a,b,c,d,e) sl@0: #define __PXYPRINT8BIT1(t,a) sl@0: #define __PXYPRINT1TEMP(t,a) sl@0: #endif // _PROXY_DEBUG_PRINT_ sl@0: sl@0: #if defined(_HOST_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) sl@0: #define __HOSTPRINT(t) {RDebug::Print(t);} sl@0: #define __HOSTPRINT1(t,a) {RDebug::Print(t,a);} sl@0: #define __HOSTPRINT2(t,a,b) {RDebug::Print(t,a,b);} sl@0: #define __HOSTPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} sl@0: #define __HOSTPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} sl@0: #define __HOSTPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} sl@0: #define __HOSTPRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);} sl@0: #define __HOSTPRINT1TEMP(t,a) {TBuftemp(a);RDebug::Print(t,&temp);} sl@0: static const TUint KBlockSize = 0x200; sl@0: #else sl@0: #define __HOSTPRINT(t) sl@0: #define __HOSTPRINT1(t,a) sl@0: #define __HOSTPRINT2(t,a,b) sl@0: #define __HOSTPRINT3(t,a,b,c) sl@0: #define __HOSTPRINT4(t,a,b,c,d) sl@0: #define __HOSTPRINT5(t,a,b,c,d,e) sl@0: #define __HOSTPRINT8BIT1(t,a) sl@0: #define __HOSTPRINT1TEMP(t,a) sl@0: #endif // _HOST_DEBUG_PRINT_ sl@0: sl@0: #endif // PXY_DEBUG_H sl@0: sl@0: