//
// DewGames Log File Class
//
// Date: 10/15/2004
// Purpose: To keep a nice looking log file while a program
// is running. Will be able to see what procedures were accessed
// when and where.
//
// Brendan Lynch
//
//////////////////////////////////////////////////////////////////////
//#32
//*************************************
//Programmed by: Brendan Lynch
//Email: dewgames@gmail.com
//Website: www.dewgames.com
//*************************************
#if !defined(AFX_LOGFILE_H__4DCD1963_B624_4D33_AFAA_09210CDE7EE5__INCLUDED_)
#define AFX_LOGFILE_H__4DCD1963_B624_4D33_AFAA_09210CDE7EE5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <Windows.h>
/*
LOGFILE SYNTAX DESCRIPTION:
The log file outputs logging information to an RTF file. C-style file I/O is used because it is
slightly faster than iostream. Text passed to the writer may use the following formatting tags:
[<color>] - Text after this tag will be colored the specified color.
<color> can be: BLACK, WHITE, GREY, RED, GREEN, BLUE, CYAN, YELLOW,
MAGENTA, DARK_RED, DARK_GREEN, DARK_BLUE, LIGHT_RED, LIGHT_GREEN,
LIGHT_BLUE, ORANGE.
[PLAIN] - Text after this tag will be unformatted
[B], [/B] - Text in between these two tags will be bolded
[I], [/I] - Text in between these two tags will be italicized
[U], [/U] - Text in between these two tags will be underlined
[S], [/S] - Text in between these two tags will have a line through it
[SUB], [/SUB] - Text in between these two tags will be a subscript
[SUPER], [/SUPER] - Text in between these two tags will be a superscript
[LEFT] - Text will be left-justified (this is the default justification)
[RIGHT] - Text will be right-justified
[CENTER] - Text will be center-justified
[FULL] - Text will be full-justified
[TITLE], [/TITLE] - Text in between these two tags will be size 20
[H], [/H] - Text in between these two tags will be size 12
*/
enum MESSAGETYPE
{
MSG_SUCCESS = 1,
MSG_INFO = 2,
MSG_WARN = 3,
MSG_ERROR = 4,
};
enum COLORTABLE
{
BLACK = 0,
WHITE = 1,
GREY = 2,
Red = 3,
GREEN = 4,
BLUE = 5,
CYAN = 6,
YELLOW = 7,
MAGENTA = 8,
DARK_RED = 9,
DARK_GREEN = 10,
DARK_BLUE = 11,
LIGHT_RED = 12,
LIGHT_GREEN = 13,
LIGHT_BLUE = 14,
ORANGE = 15,
};
class LogFile
{
public:
LogFile();
virtual ~LogFile();
void ToggleStatus(bool onoff); //turns the logger on/off
int Init(const CString sFile);
int Close();
bool GetState();
bool LogString(CString sText);
bool LogMessage(const CString sSource, const CString sMessage, MESSAGETYPE messageType);
bool LogMessage(const CString sSource, CString sMessage, int x,MESSAGETYPE messageType);
private:
void WriteString(const CString sText);
CString DoFormatting (CString sText);
bool loaded_;
bool status_; //if true write log, if false dont write log
HANDLE hFile_;
CString fileName_;
};
#endif // !defined(AFX_LOGFILE_H__4DCD1963_B624_4D33_AFAA_09210CDE7EE5__INCLUDED_)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>