testexecfw/useremul/inc/Logger.h
changeset 0 3e07fef1e154
equal deleted inserted replaced
-1:000000000000 0:3e07fef1e154
       
     1 /*------------------------------------------------------------------
       
     2  -
       
     3  * Software Name : UserEmulator
       
     4  * Version       : v4.2.1309
       
     5  * 
       
     6  * Copyright (c) 2009 France Telecom. All rights reserved.
       
     7  * This software is distributed under the License 
       
     8  * "Eclipse Public License - v 1.0" the text of which is available
       
     9  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10  *
       
    11  * Initial Contributors:
       
    12  * France Telecom 
       
    13  *
       
    14  * Contributors:
       
    15  *------------------------------------------------------------------
       
    16  -
       
    17  * File Name: Logger.h
       
    18  * 
       
    19  * Created: 13/08/2009
       
    20  * Author(s): Marcell Kiss, Reshma Sandeep Das
       
    21  *   
       
    22  * Description:
       
    23  * This class is used for logging purposes
       
    24  *------------------------------------------------------------------
       
    25  -
       
    26  *
       
    27  */
       
    28 
       
    29 #ifndef LOGGER_H__
       
    30 #define LOGGER_H__
       
    31 
       
    32 //System Includes
       
    33 #include <eikenv.h>
       
    34 #include <flogger.h>
       
    35 #include <f32file.h>
       
    36 
       
    37 //User Includes
       
    38 #include "UserEmulatorScriptsView.h"
       
    39 #include "Constants.h"
       
    40 
       
    41 //Forward Declarations
       
    42 class CSettings;
       
    43 
       
    44 /**
       
    45  * CLogger 
       
    46  * Class used for logging purposes
       
    47  */
       
    48 class CLogger : public CBase
       
    49 {
       
    50 public:
       
    51    
       
    52    /**
       
    53 	* ConstructL
       
    54 	*/
       
    55 	void ConstructL();
       
    56    /**
       
    57 	* Constructor
       
    58 	* @param aScriptView Reference to the script view
       
    59 	* @param aSettings Reference to the CSettings class
       
    60 	* @param aEikonEnv Reference to the CEikonEnv class
       
    61 	*/
       
    62 	CLogger(CUserEmulatorScriptsView& aScriptView,CSettings& aSettings, CEikonEnv* aEikonEnv);
       
    63    /**
       
    64 	* Destructor
       
    65 	*/
       
    66 	~CLogger();
       
    67  
       
    68    /**
       
    69 	* Function to write log into the log file
       
    70 	* @param aText Reference to a 8 bit descriptor
       
    71 	* @param aHeader boolean indicating presence of headers or values in the logging information
       
    72 	* @param aHash boolean indicating presence of # in the begging of the log line
       
    73 	*/
       
    74     void WriteLogL(const TDesC8& aText, TBool aHeader,TBool aHash=EFalse);
       
    75    
       
    76    /**
       
    77 	* Function to write log into the log file
       
    78 	* @param aText Reference to a 16 bit descriptor
       
    79 	* @param aHeader boolean indicating presence of headers or values in the logging information
       
    80 	* @param aHash boolean indicating presence of # in the begging of the log line
       
    81 	*/
       
    82     void WriteLogL(const TDesC16& aText, TBool aHeader,TBool aHash=EFalse);
       
    83    
       
    84    /**
       
    85 	* Function to close log file handles
       
    86 	*/
       
    87     void CloseFileHandles();
       
    88     
       
    89 private:
       
    90    /**
       
    91 	* Function to write log into the log file
       
    92 	* @param aText Reference to a 8 bit descriptor
       
    93 	* @param aHeader boolean indicating presence of headers or values in the logging information
       
    94 	* @param aHash boolean indicating presence of # in the begging of the log line
       
    95 	*/
       
    96 	TInt Write(const TDesC8& aText, TBool aHeader,TBool aHash=EFalse);
       
    97    /**
       
    98 	* Function to write log into the log file
       
    99 	* @param aText Reference to a 16 bit descriptor
       
   100 	* @param aHeader boolean indicating presence of headers or values in the logging information
       
   101 	* @param aHash boolean indicating presence of # in the begging of the log line
       
   102 	*/
       
   103 	TInt Write(const TDesC16& aText, TBool aHeader,TBool aHash=EFalse);
       
   104 private:
       
   105    /**
       
   106 	* Reference to the file handle
       
   107 	*/
       
   108     RFile 		 iFile;
       
   109    /**
       
   110  	* Reference to the file server session
       
   111  	*/
       
   112     RFs   		 iFs;
       
   113    /**
       
   114   	* Log buffer
       
   115   	*/
       
   116     TBuf8<KBuffer1024>  iLogBuffer;
       
   117    /**
       
   118   	* Reference to the CSettings class 
       
   119   	*/
       
   120     CSettings& 	 iSettings;
       
   121    /**
       
   122   	* Reference to the CEikonEnv class
       
   123   	*/
       
   124     CEikonEnv* 	 iEEnv;
       
   125    /**
       
   126    	* Reference to the CUSerEmulatorScriptsView class
       
   127    	*/
       
   128     CUserEmulatorScriptsView& iScriptView;
       
   129    /**
       
   130    	* Boolean indicating drive validity
       
   131    	*/
       
   132     TBool		 iDriveLockError;
       
   133 };
       
   134 
       
   135 #endif //__LOGGER_H__