debug.h

来自「PPP服务端实现例子」· C头文件 代码 · 共 48 行

H
48
字号
//Debug.h - Generic debug information output engine
//Robert Merrison - 2001

#ifndef _DEBUG_H_
#define _DEBUG_H_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

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

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?