diff -r 000000000000 -r e4d67989cc36 lowlevellibsandfws/apputils/src/stringlogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lowlevellibsandfws/apputils/src/stringlogger.cpp Tue Feb 02 02:01:42 2010 +0200 @@ -0,0 +1,88 @@ +// Copyright (c) 2001-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: +// + +#include +#include +#include "StringPoolImplementation.h" + +//#define BAFL_SHOW_TRACE + +#ifdef BAFL_SHOW_TRACE +void BaflShowTrace(TRefByValue aFmt,...) + { + RDebug::Print(aFmt); + } +#else +void BaflShowTrace(TRefByValue /*aFmt*/,...) + { + } +#endif + +#ifdef _DEBUG + +_LIT8(KLogPrefix, "StringPool: "); +_LIT8(KTooLong, "(Value Too Long to print)"); + +NONSHARABLE_CLASS(TStringLogOverflow) : public TDes8Overflow + { +public: + virtual void Overflow(TDes8& aDes); + }; + +void TStringLogOverflow::Overflow(TDes8& /* aDes*/) + { + } + +void StringUtils::LogIt(TRefByValue aFmt, ...) +// +// Messages to the front end emulator and to the WAP log + { + VA_LIST list; + VA_START(list,aFmt); + + _LIT8(KLogPrefix, "StringPool: "); + + TStringLogOverflow overflow; + + TBuf8 buf; + buf.Copy(KLogPrefix); + buf.AppendFormatList(aFmt, list, &overflow); + VA_END(list); + + TBuf buf16; + buf16.Copy(buf); + BaflShowTrace(buf16); + BaflShowTrace(_L("\n")); + } +void StringUtils::LogIt1(TRefByValue aFmt) +// +// Messages to the front end emulator and to the WAP log + { + const TDesC8& format = aFmt; + + TBuf8 buf; + buf.Copy(KLogPrefix); + if (buf.Length() + format.Length() > KMaxFileName - 1) + buf.Append(KTooLong); + else + buf.Append(aFmt); + + TBuf buf16; + buf16.Copy(buf); + BaflShowTrace(_L("%S"), &buf16); + BaflShowTrace(_L("\n")); + } + +#endif // _DEBUG