diff -r b183ec05bd8c -r 19bba8228ff0 fotaapplication/fotaserver/fotacustcmds/inc/fotastartupDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/fotacustcmds/inc/fotastartupDebug.h Wed Sep 01 12:27:42 2010 +0100 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file defines logging macros for Fotastartupextension log +* +*/ + + + + +#ifndef FOTASTARTUPDEBUG_H +#define FOTASTARTUPDEBUG_H + +#include +#include + +//Examples +//FLOG( _L( "[fotastartupextensionplugin] CFotaStartupExtensionPlugIn::NewL:" ) ); +//FTRACE(RDebug::Print(_L("[fotastartupextensionplugin] fotastartupextensionplugin::NewL: err (%d)"), err)); +#ifdef _DEBUG + +const TInt KBTHexDumpWidth=16; +const TInt KBTLogBufferSize=100; +const TText KFullStopChar='.'; + +_LIT(KBTFirstFormatString,"%04x: "); +_LIT(KBTSecondFormatString,"%02x "); +_LIT(KBTThirdFormatString,"%c"); +_LIT(KBTThreeSpaces," "); +_LIT(KBTSeparator," "); + +inline void HexDump(const TUint8* aPtr, TInt aLen) + { + if( aPtr != NULL ) + { + TBuf line; + TInt i = 0; + + while (aLen>0) + { + TInt n = (aLen>KBTHexDumpWidth ? KBTHexDumpWidth : aLen); + line.AppendFormat(KBTFirstFormatString,i); + TInt j; + for (j=0; j126 || aPtr[i+j]==37) ? KFullStopChar : aPtr[i+j]); + + RDebug::Print(line); + + line.Zero(); + aLen-=n; + i+=n; + } + } + } + + +// =========================================================================== +#ifdef __WINS__ // File logging for WINS +// =========================================================================== +#include +#include +#include + +_LIT( KLogFile, "fotacustcmds.log" ); +_LIT( KLogDirFullName, "c:\\logs\\" ); +_LIT( KLogDir, "fota" ); + +#define FLOG( a ) { FPrint(a); } +#define FTRACE( a ) { a; } + +// Declare the FPrint function +// +inline void FPrint( const TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir, + KLogFile, + EFileLoggingModeAppend, + aFmt, + list ); + } + +// =========================================================================== +#else // RDebug logging for target HW +// =========================================================================== +/*#include + +#define FLOG( a ) { RDebug::Print( a ); } +#define FTRACE( a ) { a; } + +*/ + +/////////////////////////////// +#include +#include +#include + +_LIT( KLogFile, "fotacustcmds.log" ); +_LIT( KLogDirFullName, "c:\\logs\\" ); +_LIT( KLogDir, "fota" ); + +#define FLOG( a ) { FPrint(a); } +#define FTRACE( a ) { a; } + +// Declare the FPrint function +// +inline void FPrint( const TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir, + KLogFile, + EFileLoggingModeAppend, + aFmt, + list ); + } + +//////////////////////////////// + + +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG( a ) +#define FTRACE( a ) + +#endif // _DEBUG + +///////// /////////////////////// +inline void LOGX(TInt aSource) + { + HBufC *iMyBufNumber = HBufC::NewLC(255); + TPtr bufNumberPtr(iMyBufNumber->Des()); + bufNumberPtr.FillZ(); + bufNumberPtr.AppendFormat(_L("%d"),aSource); + FLOG(iMyBufNumber->Des()); + CleanupStack::PopAndDestroy(); + } +///////// /////////////////////// + +#endif // FOTASTARTUP_H + +// End of File