From 2b212588aa7b64a5b1bd9896d089526d1640dda3 Mon Sep 17 00:00:00 2001 From: Stephen G Tuggy Date: Thu, 25 Apr 2024 09:59:06 -0700 Subject: [PATCH] ... --- .../audio/renderers/OpenAL/OpenALRenderer.cpp | 6 ++- engine/src/vs_logging.cpp | 53 ++----------------- engine/src/vs_logging.h | 1 - 3 files changed, 7 insertions(+), 53 deletions(-) diff --git a/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp b/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp index ad4d2436d..606882fb7 100644 --- a/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp +++ b/engine/src/audio/renderers/OpenAL/OpenALRenderer.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2001-2022 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * OpenALRenderer.cpp + * + * Copyright (C) 2001-2024 Daniel Horn, pyramid3d, Stephen G. Tuggy, * and other Vega Strike contributors. * * https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -13,7 +15,7 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License diff --git a/engine/src/vs_logging.cpp b/engine/src/vs_logging.cpp index 0df491f9c..1959cdbcb 100644 --- a/engine/src/vs_logging.cpp +++ b/engine/src/vs_logging.cpp @@ -29,14 +29,11 @@ #include #include -#include #include #include #include #include #include -#include -#include #include #include #include @@ -46,13 +43,6 @@ namespace VegaStrikeLogging { -// void exitProgram(int code) -// { -// Music::CleanupMuzak(); -// VegaStrikeLogging::VegaStrikeLogger::instance().FlushLogs(); -// winsys_exit(code); -// } - void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, const boost::filesystem::path &vega_strike_home_dir) { @@ -76,7 +66,7 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, break; } - file_log_back_end_ = boost::make_shared + file_log_sink_ = boost::log::add_file_log ( boost::log::keywords::file_name = logging_dir_name + "/" + "vegastrike_%Y-%m-%d_%H_%M_%S.%f.log", /*< file name pattern >*/ @@ -91,23 +81,12 @@ void VegaStrikeLogger::InitLoggingPart2(const uint8_t debug_level, boost::log::keywords::min_free_space = 5UL * 1024UL * 1024UL * 1024UL /*< stop boost::log when there's only 5 GiB free space left >*/ ); - file_log_sink_ = boost::make_shared(file_log_back_end_); - logging_core_->add_sink(file_log_sink_); console_log_sink_->set_filter(severity >= important_info); } void VegaStrikeLogger::FlushLogs() { logging_core_->flush(); -// if (console_log_sink_) { -//// console_log_sink_->feed_records(); -// console_log_sink_->flush(); -// } -// if (file_log_sink_) { -//// file_log_sink_->feed_records(); -// file_log_sink_->flush(); -// } - std::cout << std::flush; std::cerr << std::flush; std::clog << std::flush; @@ -117,33 +96,11 @@ void VegaStrikeLogger::FlushLogs() { void VegaStrikeLogger::FlushLogsProgramExiting() { logging_core_->flush(); -// if (console_log_sink_) { -// logging_core_->remove_sink(console_log_sink_); -//// console_log_sink_->stop(); -// console_log_sink_->flush(); -// } -// if (console_log_back_end_) { -// console_log_back_end_->flush(); -// } -// if (file_log_sink_) { -// logging_core_->remove_sink(file_log_sink_); -//// file_log_sink_->stop(); -// file_log_sink_->flush(); -// } -// if (file_log_back_end_) { -// file_log_back_end_->flush(); -// } - std::cout << std::flush; std::cerr << std::flush; std::clog << std::flush; fflush(stdout); fflush(stderr); - -// console_log_sink_.reset(); -// file_log_sink_.reset(); -// console_log_back_end_.reset(); -// file_log_back_end_.reset(); } BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { @@ -155,18 +112,14 @@ BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, severity_logger_mt) { VegaStrikeLogger::VegaStrikeLogger() : slg_(my_logger::get()), file_log_back_end_(nullptr), file_log_sink_(nullptr) { boost::filesystem::path::imbue(std::locale("")); logging_core_ = boost::log::core::get(); - // slg_ = my_logger::get(); - - console_log_back_end_ = boost::make_shared + console_log_sink_ = boost::log::add_console_log ( - boost::shared_ptr(&std::cerr, boost::null_deleter()), + std::cerr, boost::log::keywords::format = "%Message%", /*< log record format specific to the console >*/ boost::log::keywords::auto_flush = true /*false*/ /*< whether to do the equivalent of fflush(stdout) after every msg >*/ ); - console_log_sink_ = boost::make_shared(console_log_back_end_); - logging_core_->add_sink(console_log_sink_); } VegaStrikeLogger::~VegaStrikeLogger() { diff --git a/engine/src/vs_logging.h b/engine/src/vs_logging.h index c4090544a..044103bb0 100644 --- a/engine/src/vs_logging.h +++ b/engine/src/vs_logging.h @@ -33,7 +33,6 @@ #include #include #include -//#include #include #include #include