gsdebug.cpp
来自「混乱竞技场的全套代码,客户端资源可以网上搜」· C++ 代码 · 共 66 行
CPP
66 行
#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 + =
减小字号Ctrl + -
显示快捷键?