common/tools/ats/smoketest/lbs/lbstestutils/src/ctdumper.cpp
changeset 748 e13acd883fbe
child 872 17498133d9ad
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/ctdumper.cpp	Tue Nov 10 13:50:58 2009 +0000
@@ -0,0 +1,69 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <flogger.h>
+#include <ctdumper.h>
+
+const TInt KLbsDevLogMaxBufSize = 150;
+_LIT(KLbsDevLogFolder, "refFiles");
+_LIT(KLbsDevLogFile,"gpsUpdates.txt");
+
+
+/** Static function, overwrites de log file if it already exists.
+@internalTechnology
+@prototype
+*/
+EXPORT_C void CT_Dumper::OverWrite()
+	{
+	RFileLogger logger;
+	TInt err = logger.Connect();
+	
+	if (err == KErrNone)
+		{
+		logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeOverwrite);
+		}
+		
+	logger.Close();
+	}
+
+
+/** Static function, one parameter
+@param aFmt TDes string reference 
+@internalTechnology
+@prototype
+*/
+EXPORT_C void CT_Dumper::Write(TRefByValue<const TDesC16> aFmt, ...)
+	{
+	RFileLogger logger;
+	TInt err = logger.Connect();
+	
+	if (err == KErrNone)
+		{
+		VA_LIST list;
+		VA_START(list, aFmt);
+		TBuf16<KLbsDevLogMaxBufSize> strList;
+		strList.FormatList(aFmt, list);
+		VA_END(list);
+		TBuf16<KLbsDevLogMaxBufSize> txt;
+		
+		txt.Append(strList);
+
+		logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeAppend);
+		logger.SetDateAndTime(EFalse, EFalse);
+		logger.Write(txt);		
+		}
+		
+	logger.Close();
+	}