From 3187dbf0aa0943d9eca0c5c1259f8a8ca549709b Mon Sep 17 00:00:00 2001 From: tycho Date: Sun, 30 Aug 2015 22:57:43 +0100 Subject: Increase robustness of the logging subsystem --- Tools/ProtoProxy/ProtoProxy.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Tools/ProtoProxy') diff --git a/Tools/ProtoProxy/ProtoProxy.cpp b/Tools/ProtoProxy/ProtoProxy.cpp index 2d27d7556..06a486778 100644 --- a/Tools/ProtoProxy/ProtoProxy.cpp +++ b/Tools/ProtoProxy/ProtoProxy.cpp @@ -15,11 +15,17 @@ int main(int argc, char ** argv) { // Initialize logging subsystem: - cLogger::InitiateMultithreading(); auto consoleLogListener = MakeConsoleListener(false); - auto fileLogListener = new cFileListener(); - cLogger::GetInstance().AttachListener(consoleLogListener); - cLogger::GetInstance().AttachListener(fileLogListener); + auto consoleAttachment = cLogger::GetInstance().AttachListener(std::move(consoleLogListener)); + auto fileLogListenerRet = MakeFileListener(); + if (!fileLogListenerRet.first) + { + LOGERROR("Failed to open log file, aborting"); + return EXIT_FAILURE; + } + auto fileAttachment = cLogger::GetInstance().AttachListener(std::move(fileLogListenerRet.second)); + + cLogger::InitiateMultithreading(); int ListenPort = (argc > 1) ? atoi(argv[1]) : 25564; int ConnectPort = (argc > 2) ? atoi(argv[2]) : 25565; -- cgit v1.2.3