2002-08-26 06:40:49 +00:00
|
|
|
#ifndef RAGELOG_H
|
|
|
|
|
#define RAGELOG_H
|
|
|
|
|
|
2002-05-01 19:14:55 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: RageLog
|
|
|
|
|
|
|
|
|
|
Desc: Manages logging
|
|
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-05-01 19:14:55 +00:00
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2002-08-26 06:40:49 +00:00
|
|
|
#include <stdio.h>
|
2002-05-01 19:14:55 +00:00
|
|
|
|
|
|
|
|
class RageLog
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
RageLog();
|
|
|
|
|
~RageLog();
|
|
|
|
|
|
2002-08-26 06:40:49 +00:00
|
|
|
void Trace( const char *fmt, ...);
|
|
|
|
|
void Warn( const char *fmt, ...);
|
2003-01-19 05:00:21 +00:00
|
|
|
void Info( const char *fmt, ...);
|
2002-05-01 19:14:55 +00:00
|
|
|
void Flush();
|
|
|
|
|
|
2002-05-29 09:47:24 +00:00
|
|
|
void ShowConsole();
|
|
|
|
|
void HideConsole();
|
|
|
|
|
|
2003-04-22 05:21:25 +00:00
|
|
|
void MapLog(const CString &key, const char *fmt, ...);
|
|
|
|
|
void UnmapLog(const CString &key);
|
|
|
|
|
|
2003-07-22 05:05:39 +00:00
|
|
|
static void GetAdditionalLog( const char* &p, int &size );
|
|
|
|
|
|
2003-01-24 01:35:15 +00:00
|
|
|
private:
|
|
|
|
|
FILE *m_fileLog, *m_fileInfo;
|
|
|
|
|
void Write( int, CString );
|
2003-04-22 05:21:25 +00:00
|
|
|
void UpdateMappedLog();
|
2002-05-01 19:14:55 +00:00
|
|
|
};
|
|
|
|
|
|
2003-04-22 05:53:18 +00:00
|
|
|
/* Mapped log entry that's deleted on dtor. Note that this isn't extremely
|
|
|
|
|
* fast (like VDCHECKPOINT); don't use it in inner loops. */
|
|
|
|
|
struct Checkpoint_
|
|
|
|
|
{
|
|
|
|
|
CString key;
|
2003-04-27 21:55:31 +00:00
|
|
|
Checkpoint_(CString key, int n, const char *fmt, ...);
|
2003-04-22 05:53:18 +00:00
|
|
|
~Checkpoint_();
|
|
|
|
|
};
|
2003-04-23 02:45:08 +00:00
|
|
|
#define Checkpoint(t) Checkpoint_ CP_( __FILE__, __LINE__, t )
|
2002-08-26 06:40:49 +00:00
|
|
|
|
2003-04-22 05:53:18 +00:00
|
|
|
extern RageLog* LOG; // global and accessable from anywhere in our program
|
2002-11-16 06:56:25 +00:00
|
|
|
#endif
|