From c59b8c501c407a972fb0ae2744391d5cd06fa326 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Sun, 15 Mar 2026 14:59:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=94=A8Engine=20Logger=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E6=97=A7=E6=97=A5=E5=BF=97=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/D3D12/main.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/tests/D3D12/main.cpp b/tests/D3D12/main.cpp index d961e5b9..042e2382 100644 --- a/tests/D3D12/main.cpp +++ b/tests/D3D12/main.cpp @@ -30,8 +30,6 @@ using namespace XCEngine::Debug; #pragma comment(lib,"d3dcompiler.lib") #pragma comment(lib,"winmm.lib") -static FILE* gLogFile = nullptr; - void Log(const char* format, ...) { char buffer[1024]; va_list args; @@ -39,16 +37,7 @@ void Log(const char* format, ...) { vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); - vprintf(format, args); - - if (gLogFile) { - va_start(args, format); - vfprintf(gLogFile, format, args); - va_end(args); - fflush(gLogFile); - } - - Logger::Get().Debug(LogCategory::General, buffer); + Logger::Get().Debug(LogCategory::Rendering, 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) { - fopen_s(&gLogFile, "D3D12_log.txt", "w"); - Logger::Get().AddSink(std::make_unique("D3D12_engine_log.txt")); 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(); return 0; }