diff -r 000000000000 -r 5a93021fdf25 connectionmonitoring/connmonext/inc/log.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectionmonitoring/connmonext/inc/log.h Thu Dec 17 08:55:21 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2004 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: Writes log entries for Connection Monitor Extension. +* +*/ + +#ifndef CONNECTIONMONITOREXTLOG_H +#define CONNECTIONMONITOREXTLOG_H + +#include +#include + +#ifdef _DEBUG + #define LOG(a) a +#else + #define LOG(a) +#endif + +#ifdef _DEBUG + +#include + +_LIT( KLogFolder,"ConnMonExt" ); +_LIT( KLogFile,"ConnMonExt.txt" ); + +class Log + { +public: + static inline void Write( const TDesC& aDes); + static inline void Printf( TRefByValue aFmt, ...); + static inline void Printf( TRefByValue aFmt, ...); + static inline void HexDump( + const TText* aHeader, + const TText* aMargin, + const TUint8* aPtr, + TInt aLen ); + }; + +inline void Log::Write( const TDesC& aDes ) + { + RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aDes ); + } + +inline void Log::Printf( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aFmt, list ); + } + +inline void Log::Printf( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list,aFmt ); + RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aFmt, list ); + } + +inline void Log::HexDump( + const TText* aHeader, + const TText* aMargin, + const TUint8* aPtr, + TInt aLen ) + { + RFileLogger::HexDump( + KLogFolder(), + KLogFile(), + EFileLoggingModeAppend, + aHeader, + aMargin, + aPtr, + aLen ); + } + +#endif // _DEBUG +#endif // CONNECTIONMONITOREXTLOG_H + +// End-of-file