refactor: 用Engine Logger替换旧日志函数
This commit is contained in:
@@ -30,8 +30,6 @@ using namespace XCEngine::Debug;
|
|||||||
#pragma comment(lib,"d3dcompiler.lib")
|
#pragma comment(lib,"d3dcompiler.lib")
|
||||||
#pragma comment(lib,"winmm.lib")
|
#pragma comment(lib,"winmm.lib")
|
||||||
|
|
||||||
static FILE* gLogFile = nullptr;
|
|
||||||
|
|
||||||
void Log(const char* format, ...) {
|
void Log(const char* format, ...) {
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
va_list args;
|
va_list args;
|
||||||
@@ -39,16 +37,7 @@ void Log(const char* format, ...) {
|
|||||||
vsnprintf(buffer, sizeof(buffer), format, args);
|
vsnprintf(buffer, sizeof(buffer), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
vprintf(format, args);
|
Logger::Get().Debug(LogCategory::Rendering, buffer);
|
||||||
|
|
||||||
if (gLogFile) {
|
|
||||||
va_start(args, format);
|
|
||||||
vfprintf(gLogFile, format, args);
|
|
||||||
va_end(args);
|
|
||||||
fflush(gLogFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::Get().Debug(LogCategory::General, buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@@ -966,8 +955,6 @@ LRESULT CALLBACK WindowProc(HWND inHWND, UINT inMSG, WPARAM inWParam, LPARAM inL
|
|||||||
// 程序入口点
|
// 程序入口点
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int inShowCmd) {
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int inShowCmd) {
|
||||||
fopen_s(&gLogFile, "D3D12_log.txt", "w");
|
|
||||||
|
|
||||||
Logger::Get().AddSink(std::make_unique<FileLogSink>("D3D12_engine_log.txt"));
|
Logger::Get().AddSink(std::make_unique<FileLogSink>("D3D12_engine_log.txt"));
|
||||||
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
Logger::Get().SetMinimumLevel(LogLevel::Debug);
|
||||||
|
|
||||||
@@ -1154,9 +1141,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gLogFile) {
|
|
||||||
fclose(gLogFile);
|
|
||||||
}
|
|
||||||
Logger::Get().Shutdown();
|
Logger::Get().Shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user