diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h index a123998..ecb8430 100644 --- a/CAPI/API/include/API.h +++ b/CAPI/API/include/API.h @@ -315,7 +315,7 @@ public: private: std::chrono::system_clock::time_point StartPoint; - std::shared_ptr logger; + std::unique_ptr logger; ILogic& logic; }; @@ -363,7 +363,7 @@ public: private: std::chrono::system_clock::time_point StartPoint; - std::shared_ptr logger; + std::unique_ptr logger; ILogic& logic; }; diff --git a/CAPI/API/include/logic.h b/CAPI/API/include/logic.h index a095a5c..dfc80dc 100644 --- a/CAPI/API/include/logic.h +++ b/CAPI/API/include/logic.h @@ -35,7 +35,7 @@ class Logic : public ILogic { private: // 日志组件 - std::shared_ptr logger; + std::unique_ptr logger; // 通信组件 std::unique_ptr pComm; diff --git a/CAPI/API/src/DebugAPI.cpp b/CAPI/API/src/DebugAPI.cpp index 26894ae..3bd066c 100644 --- a/CAPI/API/src/DebugAPI.cpp +++ b/CAPI/API/src/DebugAPI.cpp @@ -23,7 +23,7 @@ HumanDebugAPI::HumanDebugAPI(ILogic& logic, bool file, bool print, bool warnOnly printLogger->set_level(spdlog::level::off); if (warnOnly) printLogger->set_level(spdlog::level::warn); - logger = std::make_shared("apiLogger", spdlog::sinks_init_list{fileLogger, printLogger}); + logger = std::make_unique("apiLogger", spdlog::sinks_init_list{fileLogger, printLogger}); } ButcherDebugAPI::ButcherDebugAPI(ILogic& logic, bool file, bool print, bool warnOnly, int64_t playerID) : @@ -45,7 +45,7 @@ ButcherDebugAPI::ButcherDebugAPI(ILogic& logic, bool file, bool print, bool warn printLogger->set_level(spdlog::level::off); if (warnOnly) printLogger->set_level(spdlog::level::warn); - logger = std::make_shared("apiLogger", spdlog::sinks_init_list{fileLogger, printLogger}); + logger = std::make_unique("apiLogger", spdlog::sinks_init_list{fileLogger, printLogger}); } void HumanDebugAPI::StartTimer() diff --git a/CAPI/API/src/logic.cpp b/CAPI/API/src/logic.cpp index efcf5f6..073638f 100644 --- a/CAPI/API/src/logic.cpp +++ b/CAPI/API/src/logic.cpp @@ -449,7 +449,7 @@ void Logic::Main(CreateAIFunc createAI, std::string IP, std::string port, bool f printLogger->set_level(spdlog::level::off); if (warnOnly) printLogger->set_level(spdlog::level::warn); - logger = std::make_shared("logicLogger", spdlog::sinks_init_list{fileLogger, printLogger}); + logger = std::make_unique("logicLogger", spdlog::sinks_init_list{fileLogger, printLogger}); // 建立与服务器之间通信的组件 pComm = std::make_unique(IP, port);