Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Menge::Logger Class Reference

An html logger - writes messages to a formatted html file. More...

#include <Logger.h>

Public Types

enum  LogType { UNDEF_LOG, INFO_MSG, WARN_MSG, ERR_MSG }
 Classfies interpretation of the subsequent streaming elements. More...
 

Public Member Functions

MENGE_API Logger ()
 Default constructor.
 
MENGE_API ~Logger ()
 Destructor.
 
MENGE_API void close ()
 Closes the logger down.
 
MENGE_API void line ()
 Writes a solid line to the logger.
 
MENGE_API void setFile (const std::string &fileName)
 Sets the logger's output file. More...
 

Protected Member Functions

void writeHeader ()
 Writes the html header information to the given file.
 
void writeTail ()
 Writes the html tail information to the given file.
 
void processText (std::string &input)
 Process text. More...
 

Protected Attributes

bool _validFile
 Indicates if the output file is valid.
 
std::ofstream _file
 The file object for the html to be written to.
 
LogType _streamType
 The current message type.
 

Friends

MENGE_API Loggeroperator<< (Logger &logger, const std::string &msg)
 Writes strings to the logger based on current status. More...
 
MENGE_API Loggeroperator<< (Logger &logger, const char *msg)
 Writes strings to the logger based on current status. More...
 
MENGE_API Loggeroperator<< (Logger &logger, long unsigned int value)
 Writes long unsigned int to the logger based on current status. More...
 
MENGE_API Loggeroperator<< (Logger &logger, unsigned int value)
 Writes long unsigned int to the logger based on current status. More...
 
MENGE_API Loggeroperator<< (Logger &logger, int value)
 Writes int to the logger based on current status. More...
 
MENGE_API Loggeroperator<< (Logger &logger, float value)
 Writes float to the logger based on current status. More...
 
MENGE_API Loggeroperator<< (Logger &logger, double value)
 Writes double to the logger based on current status. More...
 
MENGE_API Loggeroperator<< (Logger &logger, Logger::LogType type)
 Changes the message status of the logger. More...
 

Detailed Description

An html logger - writes messages to a formatted html file.

Member Enumeration Documentation

Classfies interpretation of the subsequent streaming elements.

Enumerator
UNDEF_LOG 

No interpretation provided.

INFO_MSG 

Benign information - reports status.

WARN_MSG 

Error encountered and handled.

ERR_MSG 

Error encountered but not handled.

Member Function Documentation

void Menge::Logger::processText ( std::string &  input)
protected

Process text.

Modifies the string in place to make an html version of the text if the output file is valid, otherwise, simply returns leaving the string untouched.

Parameters
inputThe input text to write to the log. The string
void Menge::Logger::setFile ( const std::string &  fileName)

Sets the logger's output file.

If there is an error in opening the file, the logger will default to writing to the console.

Parameters
fileNameThe file name to write the html to.

Friends And Related Function Documentation

MENGE_API Logger& operator<< ( Logger logger,
const std::string &  msg 
)
friend

Writes strings to the logger based on current status.

Parameters
loggerA reference to a logger.
msgThe string to write.
Returns
A reference to the logger streamed to.
MENGE_API Logger& operator<< ( Logger logger,
const char *  msg 
)
friend

Writes strings to the logger based on current status.

Parameters
loggerA reference to a logger.
msgThe string to write.
Returns
A reference to the logger streamed to.
MENGE_API Logger& operator<< ( Logger logger,
long unsigned int  value 
)
friend

Writes long unsigned int to the logger based on current status.

Parameters
loggerA reference to a logger.
valueThe value to write.
Returns
A reference to the logger streamed to.
MENGE_API Logger& operator<< ( Logger logger,
unsigned int  value 
)
friend

Writes long unsigned int to the logger based on current status.

Parameters
loggerA reference to a logger.
valueThe value to write.
Returns
A reference to the logger streamed to.
MENGE_API Logger& operator<< ( Logger logger,
int  value 
)
friend

Writes int to the logger based on current status.

Parameters
loggerA reference to a logger.
valueThe value to write.
Returns
A reference to the logger streamed to.
MENGE_API Logger& operator<< ( Logger logger,
float  value 
)
friend

Writes float to the logger based on current status.

Parameters
loggerA reference to a logger.
valueThe value to write.
Returns
A reference to the logger streamed to.
MENGE_API Logger& operator<< ( Logger logger,
double  value 
)
friend

Writes double to the logger based on current status.

Parameters
loggerA reference to a logger.
valueThe value to write.
Returns
A reference to the logger streamed to.
MENGE_API Logger& operator<< ( Logger logger,
Logger::LogType  type 
)
friend

Changes the message status of the logger.

Parameters
loggerA reference to a logger.
typeThe value to write.
Returns
A reference to the logger streamed to.

The documentation for this class was generated from the following files: