diff -r 000000000000 -r 3553901f7fa8 telephonyserverplugins/ctsydispatchlayer/src/ltsylogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telephonyserverplugins/ctsydispatchlayer/src/ltsylogger.cpp Tue Feb 02 01:41:59 2010 +0200 @@ -0,0 +1,98 @@ +// Copyright (c) 2008-2009 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: +// Logging macros for Tsy. These use the Comms Debug / Flogger V2 +// Framework. +// + + + +/** + @file + @internalComponent +*/ + +#include + +#ifdef _DEBUG +#include +#include + +const TInt KLineLength = 255; + +EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer) +/** +Constructor: log the function name entry +*/ + :iFnName(aFnName), iLayer(aLayer), iErr(KErrNone) + { + RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8(">>%S"), &iFnName); + }; + +EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue aFmt, ...) +/** +Write the function name entry plus plus 8 bits formated list +*/ + :iFnName(aFnName), iLayer(aLayer), iErr(KErrNone) + { + VA_LIST list; + VA_START(list,aFmt); + TBuf8 line; + line.Append(_L8(">>")); + line.Append(iFnName); + line.Append(' '); + line.Append(aFmt); + RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list); + }; + +EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue aFmt, ...) +/** +Write the function name entry plus 16 bits formated list +*/ + :iFnName(aFnName), iLayer(aLayer), iErr(KErrNone) + { + VA_LIST list; + VA_START(list,aFmt); + + TBuf line; + line.Copy(iFnName); + line.Insert(0,_L(">>")); + line.Append(' '); + line.Append(aFmt); + RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list); + }; + +EXPORT_C TLogEntryExit::~TLogEntryExit() +/** +Write the function name exit +*/ + { + if (iErr == KErrNone) + { + RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S"), &iFnName); + } + else + { + RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S [err=%d]"), &iFnName, iErr); + } + }; + +#else // #ifdef _DEBUG + +// stub export for urel builds +EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/){}; +EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue /*aFmt*/, ...){}; +EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue /*aFmt*/, ...){}; +EXPORT_C TLogEntryExit::~TLogEntryExit() {}; + +#endif // #ifdef _DEBUG