www.pudn.com > rDUNclientBeta1.zip > Debug.h


//Debug.h - Generic debug information output engine 
//Copyright (C) Robert Merrison 2001 
 
//This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License  
//as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 
//This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied  
//warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 
//You should have received a copy of the GNU General Public License along with this program; if not, write to the  
//Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 
#ifndef _DEBUG_H_ 
#define _DEBUG_H_ 
 
#include  
#include  
#include  
#include  
 
class time_engine; 
 
enum { DBLEVEL_LOW = 1, DBLEVEL_MED, DBLEVEL_HIGH }; 
enum { MSG_NOTICE = 1, MSG_STATUS, MSG_ERROR, MSG_CRITICAL }; 
 
class	debug_engine{ 
public: 
	debug_engine( ); 
	~debug_engine( ); 
	 
	bool	init( short debug_level = DBLEVEL_MED, char* debug_filename = NULL, time_engine* timer_engine = NULL ); 
	bool	kill( ); 
	bool	log_message( short msg_type, char* message, ... ); 
	void	check_file_size(); 
 
 
private: 
	int		bytes_written;	//Number of kb of data written to debug file 
	 
	char	filename[256]; 
	 
	short	file_size_limit; 
	short	level; 
	 
	FILE*	debug_file; 
 
	time_engine*	timer; 
 
	bool	open_debug_file( char* debug_filename );  
	bool	must_log( short msg_type ); 
	bool	is_inited; 
	bool	write_file; 
	bool	log_time; 
}; 
 
#endif