// Author : Chris Tolley
// Date   : 2/28/2004
// logger.h contains the class declaration for an event/error logger.  It 
// logs stuff into an xml data files.  To use the logger, you only have to 
// include it into your and each file you want to log events from.  All members
// in this class are static so just create the output file stream from your 
// main and then call the logging functions from anywhere in your code.

#ifndef LOGGER_H
#define LOGGER_H

#include <iostream>
#include <fstream>
#include <string>

using std::ofstream;
using std::string;

class logger
{
public:
	// Opens an output file stream for log storing. Should be an xml file
	static void open( const char* file );

	// Closes the log file so that no more logging can happen
	static void close();

	// Writes an error to the data file.  function is the name of the functino
	// that you are in and msg is a message you want written.
	static void error( const string& function, const string& msg );

	// The following functions writes an event to the log.  function is
	// the name of the function where the event took place and data is a
	// piece of data.
	static void event( const string& function, const string& msg, const string& data );
	static void event( const string& function, const string& msg, const int& data );
	static void event( const string& function, const string& msg, const float& data );
	static void event( const string& function, const string& msg, const double& data );
	static void event( const string& function, const string& msg, const bool& data );
	static void event( const string& function, const string& msg, const unsigned int& data );
private:
	// Private Constructor.  No one gets to use it
	logger() {};

	// Destructor
	virtual ~logger() {};

	// The output file stream to send log data to
	static ofstream out_;

	// True if logging is on
	static bool loggingOn_;

	// The number of the event/error
	static int entryNumber_;
};// End logger::class

#endif
