common/tools/ats/smoketest/lbs/lbstestutils/src/ctdumper.cpp
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <flogger.h>
       
    17 #include <ctdumper.h>
       
    18 
       
    19 const TInt KLbsDevLogMaxBufSize = 150;
       
    20 _LIT(KLbsDevLogFolder, "refFiles");
       
    21 _LIT(KLbsDevLogFile,"gpsUpdates.txt");
       
    22 
       
    23 
       
    24 /** Static function, overwrites de log file if it already exists.
       
    25 @internalTechnology
       
    26 @prototype
       
    27 */
       
    28 EXPORT_C void CT_Dumper::OverWrite()
       
    29 	{
       
    30 	RFileLogger logger;
       
    31 	TInt err = logger.Connect();
       
    32 	
       
    33 	if (err == KErrNone)
       
    34 		{
       
    35 		logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeOverwrite);
       
    36 		}
       
    37 		
       
    38 	logger.Close();
       
    39 	}
       
    40 
       
    41 
       
    42 /** Static function, one parameter
       
    43 @param aFmt TDes string reference 
       
    44 @internalTechnology
       
    45 @prototype
       
    46 */
       
    47 EXPORT_C void CT_Dumper::Write(TRefByValue<const TDesC16> aFmt, ...)
       
    48 	{
       
    49 	RFileLogger logger;
       
    50 	TInt err = logger.Connect();
       
    51 	
       
    52 	if (err == KErrNone)
       
    53 		{
       
    54 		VA_LIST list;
       
    55 		VA_START(list, aFmt);
       
    56 		TBuf16<KLbsDevLogMaxBufSize> strList;
       
    57 		strList.FormatList(aFmt, list);
       
    58 		VA_END(list);
       
    59 		TBuf16<KLbsDevLogMaxBufSize> txt;
       
    60 		
       
    61 		txt.Append(strList);
       
    62 
       
    63 		logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeAppend);
       
    64 		logger.SetDateAndTime(EFalse, EFalse);
       
    65 		logger.Write(txt);		
       
    66 		}
       
    67 		
       
    68 	logger.Close();
       
    69 	}