From c6281d799f1860fe291c7ad31c9cd0aa3ec1a3e0 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Tue, 19 Apr 2022 16:01:45 -0500 Subject: [PATCH] Removing boost log from Boost.Log -> spdlog - settings, types, util, view --- .../scwx/qt/request/nexrad_file_request.cpp | 5 +- .../scwx/qt/settings/general_settings.cpp | 12 ++-- .../scwx/qt/settings/palette_settings.cpp | 12 ++-- .../scwx/qt/types/radar_product_record.cpp | 5 +- scwx-qt/source/scwx/qt/util/font.cpp | 28 ++++---- scwx-qt/source/scwx/qt/util/font_buffer.cpp | 9 ++- scwx-qt/source/scwx/qt/util/json.cpp | 69 ++++++++++--------- .../scwx/qt/view/level2_product_view.cpp | 21 +++--- .../scwx/qt/view/level3_product_view.cpp | 3 +- .../scwx/qt/view/level3_radial_view.cpp | 26 +++---- .../scwx/qt/view/level3_raster_view.cpp | 25 +++---- .../scwx/qt/view/radar_product_view.cpp | 7 +- .../qt/view/radar_product_view_factory.cpp | 14 ++-- 13 files changed, 109 insertions(+), 127 deletions(-) diff --git a/scwx-qt/source/scwx/qt/request/nexrad_file_request.cpp b/scwx-qt/source/scwx/qt/request/nexrad_file_request.cpp index af39c1da..5324027f 100644 --- a/scwx-qt/source/scwx/qt/request/nexrad_file_request.cpp +++ b/scwx-qt/source/scwx/qt/request/nexrad_file_request.cpp @@ -1,7 +1,5 @@ #include -#include - namespace scwx { namespace qt @@ -9,8 +7,7 @@ namespace qt namespace request { -static const std::string logPrefix_ = - "[scwx::qt::request::nexrad_file_request] "; +static const std::string logPrefix_ = "scwx::qt::request::nexrad_file_request"; class NexradFileRequestImpl { diff --git a/scwx-qt/source/scwx/qt/settings/general_settings.cpp b/scwx-qt/source/scwx/qt/settings/general_settings.cpp index e1a41dbf..bc921075 100644 --- a/scwx-qt/source/scwx/qt/settings/general_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/general_settings.cpp @@ -1,7 +1,6 @@ #include #include - -#include +#include namespace scwx { @@ -10,7 +9,8 @@ namespace qt namespace settings { -static const std::string logPrefix_ = "[scwx::qt::settings::general_settings] "; +static const std::string logPrefix_ = "scwx::qt::settings::general_settings"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); static const std::string DEFAULT_DEFAULT_RADAR_SITE = "KLSX"; static const int64_t DEFAULT_GRID_WIDTH = 1; @@ -115,13 +115,11 @@ GeneralSettings::Load(const boost::json::value* json, bool& jsonDirty) { if (json == nullptr) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Key is not present, resetting to defaults"; + logger_->warn("Key is not present, resetting to defaults"); } else if (!json->is_object()) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Invalid json, resetting to defaults"; + logger_->warn("Invalid json, resetting to defaults"); } generalSettings->p->SetDefaults(); diff --git a/scwx-qt/source/scwx/qt/settings/palette_settings.cpp b/scwx-qt/source/scwx/qt/settings/palette_settings.cpp index 7e1a42b3..241e0048 100644 --- a/scwx-qt/source/scwx/qt/settings/palette_settings.cpp +++ b/scwx-qt/source/scwx/qt/settings/palette_settings.cpp @@ -1,7 +1,6 @@ #include #include - -#include +#include namespace scwx { @@ -10,7 +9,8 @@ namespace qt namespace settings { -static const std::string logPrefix_ = "[scwx::qt::settings::palette_settings] "; +static const std::string logPrefix_ = "scwx::qt::settings::palette_settings"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); static const std::vector paletteNames_ = { // Level 2 / Common Products @@ -125,13 +125,11 @@ PaletteSettings::Load(const boost::json::value* json, bool& jsonDirty) { if (json == nullptr) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Key is not present, resetting to defaults"; + logger_->warn("Key is not present, resetting to defaults"); } else if (!json->is_object()) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Invalid json, resetting to defaults"; + logger_->warn("Invalid json, resetting to defaults"); } generalSettings->p->SetDefaults(); diff --git a/scwx-qt/source/scwx/qt/types/radar_product_record.cpp b/scwx-qt/source/scwx/qt/types/radar_product_record.cpp index 0262a452..daf4a306 100644 --- a/scwx-qt/source/scwx/qt/types/radar_product_record.cpp +++ b/scwx-qt/source/scwx/qt/types/radar_product_record.cpp @@ -3,8 +3,6 @@ #include #include -#include - namespace scwx { namespace qt @@ -12,8 +10,7 @@ namespace qt namespace types { -static const std::string logPrefix_ = - "[scwx::qt::types::radar_product_record] "; +static const std::string logPrefix_ = "scwx::qt::types::radar_product_record"; class RadarProductRecordImpl { diff --git a/scwx-qt/source/scwx/qt/util/font.cpp b/scwx-qt/source/scwx/qt/util/font.cpp index b29506bd..0078d016 100644 --- a/scwx-qt/source/scwx/qt/util/font.cpp +++ b/scwx-qt/source/scwx/qt/util/font.cpp @@ -2,11 +2,11 @@ #define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING #include +#include #include #include -#include #include #include #include @@ -76,7 +76,8 @@ static const std::string CODEPOINTS = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~"; -static const std::string logPrefix_ = "[scwx::qt::util::font] "; +static const std::string logPrefix_ = "scwx::qt::util::font"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); static constexpr float BASE_POINT_SIZE = 72.0f; static constexpr float POINT_SCALE = 1.0f / BASE_POINT_SIZE; @@ -144,9 +145,8 @@ float Font::BufferText(std::shared_ptr buffer, auto it = p->glyphs_.find(c); if (it == p->glyphs_.end()) { - BOOST_LOG_TRIVIAL(info) - << logPrefix_ - << "Could not draw character: " << static_cast(c); + logger_->info("Could not draw character: {}", + static_cast(c)); continue; } @@ -198,9 +198,7 @@ float Font::TextLength(const std::string& text, float pointSize) const auto it = p->glyphs_.find(c); if (it == p->glyphs_.end()) { - BOOST_LOG_TRIVIAL(info) - << logPrefix_ - << "Character not found: " << static_cast(c); + logger_->info("Character not found: {}", static_cast(c)); continue; } @@ -242,7 +240,7 @@ GLuint Font::GenerateTexture(gl::OpenGLFunctions& gl) std::shared_ptr Font::Create(const std::string& resource) { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading font file: " << resource; + logger_->debug("Loading font file: {}", resource); std::shared_ptr font = nullptr; boost::timer::cpu_timer timer; @@ -250,7 +248,7 @@ std::shared_ptr Font::Create(const std::string& resource) auto it = fontMap_.find(resource); if (it != fontMap_.end()) { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Font already created"; + logger_->debug("Font already created"); return it->second; } @@ -258,7 +256,7 @@ std::shared_ptr Font::Create(const std::string& resource) fontFile.open(QIODevice::ReadOnly); if (!fontFile.isOpen()) { - BOOST_LOG_TRIVIAL(error) << logPrefix_ << "Could not read font file"; + logger_->error("Could not read font file"); return font; } @@ -298,8 +296,7 @@ std::shared_ptr Font::Create(const std::string& resource) } } - BOOST_LOG_TRIVIAL(debug) - << logPrefix_ << "Font loaded in " << timer.format(6, "%ws"); + logger_->debug("Font loaded in {}", timer.format(6, "%ws")); texture_font_delete(textureFont); @@ -337,9 +334,8 @@ void FontImpl::ParseNames(FT_Face face) } } - BOOST_LOG_TRIVIAL(debug) - << logPrefix_ << "Font family: " << fontData_.fontFamily_ << " (" - << fontData_.fontSubfamily_ << ")"; + logger_->debug( + "Font family: {} ({})", fontData_.fontFamily_, fontData_.fontSubfamily_); } static void ParseSfntName(const FT_SfntName& sfntName, std::string& str) diff --git a/scwx-qt/source/scwx/qt/util/font_buffer.cpp b/scwx-qt/source/scwx/qt/util/font_buffer.cpp index 92fd0a3a..53e88aff 100644 --- a/scwx-qt/source/scwx/qt/util/font_buffer.cpp +++ b/scwx-qt/source/scwx/qt/util/font_buffer.cpp @@ -1,9 +1,8 @@ #include +#include #include -#include - namespace scwx { namespace qt @@ -11,7 +10,8 @@ namespace qt namespace util { -static const std::string logPrefix_ = "[scwx::qt::util::font_buffer] "; +static const std::string logPrefix_ = "scwx::qt::util::font_buffer"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); class FontBufferImpl { @@ -140,8 +140,7 @@ void FontBuffer::Push(std::initializer_list indices, { if (indices.size() % 3 != 0 || vertices.size() % 9 != 0) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Invalid push arguments, ignoring"; + logger_->warn("Invalid push arguments, ignoring"); return; } diff --git a/scwx-qt/source/scwx/qt/util/json.cpp b/scwx-qt/source/scwx/qt/util/json.cpp index 538a80ff..0a512b7e 100644 --- a/scwx-qt/source/scwx/qt/util/json.cpp +++ b/scwx-qt/source/scwx/qt/util/json.cpp @@ -1,8 +1,8 @@ #include +#include #include -#include #include #include @@ -15,7 +15,8 @@ namespace util namespace json { -static const std::string logPrefix_ = "[scwx::qt::util::json] "; +static const std::string logPrefix_ = "scwx::qt::util::json"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); /* Adapted from: * https://www.boost.org/doc/libs/1_77_0/libs/json/doc/html/json/examples.html#json.examples.pretty @@ -50,16 +51,18 @@ bool FromJsonInt64(const boost::json::object& json, if (minValue.has_value() && value < *minValue) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << key << " less than minimum (" << value << " < " - << *minValue << "), setting to: " << *minValue; + logger_->warn("{} less than minimum ({} < {}), setting to: {2}", + key, + value, + *minValue); value = *minValue; } else if (maxValue.has_value() && value > *maxValue) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << key << " greater than maximum (" << value - << " > " << *maxValue << "), setting to: " << *maxValue; + logger_->warn("{} greater than maximum ({} > {}), setting to: {2}", + key, + value, + *maxValue); value = *maxValue; } else @@ -69,17 +72,17 @@ bool FromJsonInt64(const boost::json::object& json, } else { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << key << " is not an int64 (" << jv->kind() - << "), setting to default:" << defaultValue; + logger_->warn("{} is not an int64 ({}), setting to default: {}", + key, + jv->kind(), + defaultValue); value = defaultValue; } } else { - BOOST_LOG_TRIVIAL(debug) - << logPrefix_ << key - << " is not present, setting to default: " << defaultValue; + logger_->debug( + "{} is not present, setting to default: {}", key, defaultValue); value = defaultValue; } @@ -103,17 +106,15 @@ bool FromJsonString(const boost::json::object& json, } else { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << key - << " is not a string, setting to default: " << defaultValue; + logger_->warn( + "{} is not a string, setting to default: {}", key, defaultValue); value = defaultValue; } } else { - BOOST_LOG_TRIVIAL(debug) - << logPrefix_ << key - << " is not present, setting to default: " << defaultValue; + logger_->debug( + "{} is not present, setting to default: {}", key, defaultValue); value = defaultValue; } @@ -156,9 +157,8 @@ static boost::json::value ReadJsonFile(QFile& file) } else { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Could not open file for reading: \"" - << file.fileName().toStdString() << "\""; + logger_->warn("Could not open file for reading: \"{}\"", + file.fileName().toStdString()); } return json; @@ -176,7 +176,7 @@ static boost::json::value ReadJsonStream(std::istream& is) p.write(line, ec); if (ec) { - BOOST_LOG_TRIVIAL(warning) << logPrefix_ << ec.message(); + logger_->warn("{}", ec.message()); return nullptr; } } @@ -184,7 +184,7 @@ static boost::json::value ReadJsonStream(std::istream& is) p.finish(ec); if (ec) { - BOOST_LOG_TRIVIAL(warning) << logPrefix_ << ec.message(); + logger_->warn("{}", ec.message()); return nullptr; } @@ -199,8 +199,7 @@ void WriteJsonFile(const std::string& path, if (!ofs.is_open()) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Cannot write JSON file: \"" << path << "\""; + logger_->warn("Cannot write JSON file: \"{}\"", path); } else { @@ -277,11 +276,17 @@ static void PrettyPrintJson(std::ostream& os, break; } - case boost::json::kind::uint64: os << jv.get_uint64(); break; + case boost::json::kind::uint64: + os << jv.get_uint64(); + break; - case boost::json::kind::int64: os << jv.get_int64(); break; + case boost::json::kind::int64: + os << jv.get_int64(); + break; - case boost::json::kind::double_: os << jv.get_double(); break; + case boost::json::kind::double_: + os << jv.get_double(); + break; case boost::json::kind::bool_: if (jv.get_bool()) @@ -290,7 +295,9 @@ static void PrettyPrintJson(std::ostream& os, os << "false"; break; - case boost::json::kind::null: os << "null"; break; + case boost::json::kind::null: + os << "null"; + break; } if (indent->empty()) diff --git a/scwx-qt/source/scwx/qt/view/level2_product_view.cpp b/scwx-qt/source/scwx/qt/view/level2_product_view.cpp index 6158da0c..16ce2296 100644 --- a/scwx-qt/source/scwx/qt/view/level2_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level2_product_view.cpp @@ -1,9 +1,9 @@ #include #include +#include #include #include -#include #include #include @@ -14,7 +14,8 @@ namespace qt namespace view { -static const std::string logPrefix_ = "[scwx::qt::view::level2_product_view] "; +static const std::string logPrefix_ = "scwx::qt::view::level2_product_view"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); static constexpr uint16_t RANGE_FOLDED = 1u; static constexpr uint32_t VERTICES_PER_BIN = 6u; @@ -73,8 +74,8 @@ public: } else { - BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Unknown product: \"" - << common::GetLevel2Name(product) << "\""; + logger_->warn("Unknown product: \"{}\"", + common::GetLevel2Name(product)); dataBlockType_ = wsr88d::rda::DataBlockType::Unknown; } } @@ -347,7 +348,7 @@ void Level2ProductView::UpdateColorTable() void Level2ProductView::ComputeSweep() { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; + logger_->debug("ComputeSweep()"); boost::timer::cpu_timer timer; @@ -382,8 +383,8 @@ void Level2ProductView::ComputeSweep() if (momentData0 == nullptr) { - BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "No moment data for " - << common::GetLevel2Name(p->product_); + logger_->warn("No moment data for {}", + common::GetLevel2Name(p->product_)); return; } @@ -462,8 +463,7 @@ void Level2ProductView::ComputeSweep() if (momentData0->data_word_size() != momentData->data_word_size()) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Radial " << radial << " has different word size"; + logger_->warn("Radial {} has different word size", radial); continue; } @@ -632,8 +632,7 @@ void Level2ProductView::ComputeSweep() } timer.stop(); - BOOST_LOG_TRIVIAL(debug) - << logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws"); + logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); UpdateColorTable(); diff --git a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp index 5f380044..875fae99 100644 --- a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -17,7 +16,7 @@ namespace qt namespace view { -static const std::string logPrefix_ = "[scwx::qt::view::level3_product_view] "; +static const std::string logPrefix_ = "scwx::qt::view::level3_product_view"; static constexpr uint16_t RANGE_FOLDED = 1u; diff --git a/scwx-qt/source/scwx/qt/view/level3_radial_view.cpp b/scwx-qt/source/scwx/qt/view/level3_radial_view.cpp index 86336ab8..560319f6 100644 --- a/scwx-qt/source/scwx/qt/view/level3_radial_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_radial_view.cpp @@ -1,11 +1,11 @@ #include #include +#include #include #include #include #include -#include #include #include @@ -16,7 +16,8 @@ namespace qt namespace view { -static const std::string logPrefix_ = "[scwx::qt::view::level3_radial_view] "; +static const std::string logPrefix_ = "scwx::qt::view::level3_radial_view"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); static constexpr uint16_t RANGE_FOLDED = 1u; static constexpr uint32_t VERTICES_PER_BIN = 6u; @@ -105,7 +106,7 @@ void Level3RadialView::SelectTime(std::chrono::system_clock::time_point time) void Level3RadialView::ComputeSweep() { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; + logger_->debug("ComputeSweep()"); boost::timer::cpu_timer timer; @@ -120,8 +121,7 @@ void Level3RadialView::ComputeSweep() std::dynamic_pointer_cast(message); if (gpm == nullptr) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Graphic Product Message not found"; + logger_->warn("Graphic Product Message not found"); return; } else if (gpm == graphic_product_message()) @@ -139,7 +139,7 @@ void Level3RadialView::ComputeSweep() gpm->symbology_block(); if (descriptionBlock == nullptr || symbologyBlock == nullptr) { - BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Missing blocks"; + logger_->warn("Missing blocks"); return; } @@ -147,8 +147,7 @@ void Level3RadialView::ComputeSweep() uint16_t numberOfLayers = symbologyBlock->number_of_layers(); if (numberOfLayers < 1) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "No layers present in symbology block"; + logger_->warn("No layers present in symbology block"); return; } @@ -199,7 +198,7 @@ void Level3RadialView::ComputeSweep() } else { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No radial data found"; + logger_->debug("No radial data found"); return; } @@ -207,8 +206,7 @@ void Level3RadialView::ComputeSweep() const size_t radials = radialData->number_of_radials(); if (radials != 360 && radials != 720) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Unsupported number of radials: " << radials; + logger_->warn("Unsupported number of radials: {}", radials); return; } @@ -223,8 +221,7 @@ void Level3RadialView::ComputeSweep() const uint16_t gates = radialData->number_of_range_bins(); if (gates < 1) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "No range bins in radial data"; + logger_->warn("No range bins in radial data"); return; } @@ -368,8 +365,7 @@ void Level3RadialView::ComputeSweep() dataMoments8.shrink_to_fit(); timer.stop(); - BOOST_LOG_TRIVIAL(debug) - << logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws"); + logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); UpdateColorTable(); diff --git a/scwx-qt/source/scwx/qt/view/level3_raster_view.cpp b/scwx-qt/source/scwx/qt/view/level3_raster_view.cpp index 3bf9605d..9494ee19 100644 --- a/scwx-qt/source/scwx/qt/view/level3_raster_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_raster_view.cpp @@ -1,10 +1,10 @@ #include #include +#include #include #include #include -#include #include #include #include @@ -16,7 +16,8 @@ namespace qt namespace view { -static const std::string logPrefix_ = "[scwx::qt::view::level3_raster_view] "; +static const std::string logPrefix_ = "scwx::qt::view::level3_raster_view"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); static constexpr uint16_t RANGE_FOLDED = 1u; static constexpr uint32_t VERTICES_PER_BIN = 6u; @@ -105,7 +106,7 @@ void Level3RasterView::SelectTime(std::chrono::system_clock::time_point time) void Level3RasterView::ComputeSweep() { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; + logger_->debug("ComputeSweep()"); boost::timer::cpu_timer timer; @@ -120,8 +121,7 @@ void Level3RasterView::ComputeSweep() std::dynamic_pointer_cast(message); if (gpm == nullptr) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Graphic Product Message not found"; + logger_->warn("Graphic Product Message not found"); return; } else if (gpm == graphic_product_message()) @@ -139,7 +139,7 @@ void Level3RasterView::ComputeSweep() gpm->symbology_block(); if (descriptionBlock == nullptr || symbologyBlock == nullptr) { - BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Missing blocks"; + logger_->warn("Missing blocks"); return; } @@ -147,8 +147,7 @@ void Level3RasterView::ComputeSweep() uint16_t numberOfLayers = symbologyBlock->number_of_layers(); if (numberOfLayers < 1) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "No layers present in symbology block"; + logger_->warn("No layers present in symbology block"); return; } @@ -179,7 +178,7 @@ void Level3RasterView::ComputeSweep() if (rasterData == nullptr) { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No raster data found"; + logger_->debug("No raster data found"); return; } @@ -193,7 +192,7 @@ void Level3RasterView::ComputeSweep() if (maxColumns == 0) { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No raster bins found"; + logger_->debug("No raster bins found"); return; } @@ -256,8 +255,7 @@ void Level3RasterView::ComputeSweep() }); timer.stop(); - BOOST_LOG_TRIVIAL(debug) - << logPrefix_ << "Coordinates calculated in " << timer.format(6, "%ws"); + logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws")); // Calculate vertices timer.start(); @@ -332,8 +330,7 @@ void Level3RasterView::ComputeSweep() dataMoments8.shrink_to_fit(); timer.stop(); - BOOST_LOG_TRIVIAL(debug) - << logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws"); + logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); UpdateColorTable(); diff --git a/scwx-qt/source/scwx/qt/view/radar_product_view.cpp b/scwx-qt/source/scwx/qt/view/radar_product_view.cpp index 73ce6789..33771694 100644 --- a/scwx-qt/source/scwx/qt/view/radar_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/radar_product_view.cpp @@ -1,7 +1,7 @@ #include #include +#include -#include #include #include @@ -12,7 +12,8 @@ namespace qt namespace view { -static const std::string logPrefix_ = "[scwx::qt::view::radar_product_view] "; +static const std::string logPrefix_ = "scwx::qt::view::radar_product_view"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); static const std::vector DEFAULT_COLOR_TABLE = { boost::gil::rgba8_pixel_t(0, 128, 0, 255), @@ -102,7 +103,7 @@ RadarProductView::GetCfpMomentData() const void RadarProductView::ComputeSweep() { - BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; + logger_->debug("ComputeSweep()"); emit SweepComputed(); } diff --git a/scwx-qt/source/scwx/qt/view/radar_product_view_factory.cpp b/scwx-qt/source/scwx/qt/view/radar_product_view_factory.cpp index a188ddbb..0ee67825 100644 --- a/scwx-qt/source/scwx/qt/view/radar_product_view_factory.cpp +++ b/scwx-qt/source/scwx/qt/view/radar_product_view_factory.cpp @@ -2,11 +2,10 @@ #include #include #include +#include #include -#include - namespace scwx { namespace qt @@ -15,7 +14,8 @@ namespace view { static const std::string logPrefix_ = - "[scwx::qt::view::radar_product_view_factory] "; + "scwx::qt::view::radar_product_view_factory"; +static const auto logger_ = scwx::util::Logger::Create(logPrefix_); typedef std::function( const std::string& productName, @@ -46,8 +46,7 @@ std::shared_ptr RadarProductViewFactory::Create( if (product == common::Level2Product::Unknown) { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Unknown Level 2 radar product: " << productName; + logger_->warn("Unknown Level 2 radar product: {}", productName); } else { @@ -67,9 +66,8 @@ std::shared_ptr RadarProductViewFactory::Create( } else { - BOOST_LOG_TRIVIAL(warning) - << logPrefix_ << "Unknown radar product group: " - << common::GetRadarProductGroupName(productGroup); + logger_->warn("Unknown radar product group: {}", + common::GetRadarProductGroupName(productGroup)); } return view;