⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gsdebug.cpp

📁 网络泡泡被.net管理
💻 CPP
字号:

#include "stdafx.h"

#ifdef DEBUG_MODE


#include "GsDebug.h"
#include <stdio.h>
#include <stdarg.h>


CGsDebug::CGsDebug()
{
	file.open(debugfile,ios::trunc);
	g_pDebug	= this;
//	ADD_LOG("Debug Start.");
}

CGsDebug::CGsDebug(char* szDEBUGFILE)
{
	char	szdebugfile[100];
	wsprintf(szdebugfile,"%s.log",szDEBUGFILE);
	file.open(szdebugfile,ios::trunc);	
	g_pDebug	= this;
//	ADD_LOG("Debug Start.");
}

CGsDebug::~CGsDebug()
{
//	ADD_LOG("Debug End.");
	if(file)
		file.close();
	g_pDebug	= NULL;
}

void CGsDebug::ADD_LOG(char const*	format,...)
{
	char	log[260];
	if(!file)
		return;
//	char szLocalDate[11], szLocalTime[9];
//	SYSTEMTIME st;
//	GetLocalTime( &st );
//	GetDateFormat( LOCALE_USER_DEFAULT, 0, &st, "MM'/'dd'/'yyyy", szLocalDate, 11 );
//	GetTimeFormat( LOCALE_USER_DEFAULT, 0, &st, "HH':'mm':'ss", szLocalTime, 9 );
//	wsprintf(log,"***  output time: %s %s ***",szLocalDate,szLocalTime);
//	file<<log<<endl;
	va_list ap;
	va_start(ap, format);
	vsprintf(log, format, ap);
	va_end(ap);
	char time[20],date[20];
    _strtime( time );
    _strdate( date );
	OnAddLog(time, date, log);
	file<<time<<"     "<<date<<std::endl<<log<<std::endl<<std::endl;
}

void CGsDebug::OnAddLog(const char *time, const char *date, const char *log)
{

}

#endif

⌨️ 快捷键说明

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