testtoolsconn/stat/desktop/source/lib/inc/cstatlogfile.h
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CSTATLogFile_H
       
    22 #define CSTATLogFile_H
       
    23 
       
    24 #include <afxmt.h>
       
    25 #include "CSTATReturnCodes.h"
       
    26 #include "MessageReporter.h"
       
    27 
       
    28 class CSTATLogFile
       
    29 {
       
    30 public :
       
    31 	// logging
       
    32 	CSTATLogFile();
       
    33 	~CSTATLogFile();
       
    34 	int CreateLogFile(const CString& newlogfilename,const CString& defaultPath ,const char* prefix, bool append, bool bMessages, bool bFile);
       
    35 	void SetMessageReporter(MessageReporter *const messageReporter);
       
    36 	void WriteTimeToLog();					// write the current date/time to log
       
    37 	void Write(char *szText, ...);			// write standard text to log
       
    38 	void Write(CString cBuf);				// write CString text to log
       
    39 	void CloseLogFile();					// close
       
    40 
       
    41 	// messaging
       
    42 	int Set(const char* newtext);													// write CString to storage buffer and to log
       
    43 	int Set(int iMsgCode, const char* newtext = NULL, bool bMsgBox = false, bool bScrshot = false);
       
    44 	// bool Get(CString &msg, CString &newtext, bool &bMsgBox, bool &bScrshot);  // get log message from storage buffer
       
    45 	const char* Text(int iMsgCode) { return ReturnCodes.GetRetMsg(iMsgCode); }    // get error text
       
    46 
       
    47 	int ToAnsi(LPCTSTR szUnicode, LPSTR szBuffer, int nBufLen);
       
    48 	LPCTSTR ToUnicode(const char *string);
       
    49 
       
    50 private :
       
    51 	char* FormatText(const char* message);
       
    52 
       
    53 	CSTATReturnCodes ReturnCodes;			// return codes for use within STAT
       
    54 
       
    55 	// logging
       
    56 	CFile logfile;							// log file object
       
    57 	CString Logfilename;					// the name of our log file
       
    58 	char szLogPrefix[51];					// holds a prefix to all log messages
       
    59 
       
    60 	MessageReporter	*iMessageReporter;
       
    61 
       
    62 	// messages
       
    63 	bool bWriteToScreen;					// flag for writing to dialog box
       
    64 	bool bWriteToFile;						// flag for writing to log file
       
    65 	bool bMessage;							// flag for waiting message
       
    66 	bool bMessageBox;						// display in a MessageBox
       
    67 	bool bScreenshot;						// display associated screenshot bitmap
       
    68 	CString message;						// basic message
       
    69 	CString text;							// associated error text
       
    70 };
       
    71 
       
    72 #endif