mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 18:10:05 +00:00 
			
		
		
		
	Removing boost log from Boost.Log -> spdlog - settings, types, util, view
This commit is contained in:
		
							parent
							
								
									e6bddc79db
								
							
						
					
					
						commit
						c6281d799f
					
				
					 13 changed files with 109 additions and 127 deletions
				
			
		|  | @ -1,7 +1,5 @@ | ||||||
| #include <scwx/qt/request/nexrad_file_request.hpp> | #include <scwx/qt/request/nexrad_file_request.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -9,8 +7,7 @@ namespace qt | ||||||
| namespace request | namespace request | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::qt::request::nexrad_file_request"; | ||||||
|    "[scwx::qt::request::nexrad_file_request] "; |  | ||||||
| 
 | 
 | ||||||
| class NexradFileRequestImpl | class NexradFileRequestImpl | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| #include <scwx/qt/settings/general_settings.hpp> | #include <scwx/qt/settings/general_settings.hpp> | ||||||
| #include <scwx/qt/util/json.hpp> | #include <scwx/qt/util/json.hpp> | ||||||
| 
 | #include <scwx/util/logger.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -10,7 +9,8 @@ namespace qt | ||||||
| namespace settings | 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 std::string DEFAULT_DEFAULT_RADAR_SITE = "KLSX"; | ||||||
| static const int64_t     DEFAULT_GRID_WIDTH         = 1; | static const int64_t     DEFAULT_GRID_WIDTH         = 1; | ||||||
|  | @ -115,13 +115,11 @@ GeneralSettings::Load(const boost::json::value* json, bool& jsonDirty) | ||||||
|    { |    { | ||||||
|       if (json == nullptr) |       if (json == nullptr) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Key is not present, resetting to defaults"); | ||||||
|             << logPrefix_ << "Key is not present, resetting to defaults"; |  | ||||||
|       } |       } | ||||||
|       else if (!json->is_object()) |       else if (!json->is_object()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid json, resetting to defaults"); | ||||||
|             << logPrefix_ << "Invalid json, resetting to defaults"; |  | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       generalSettings->p->SetDefaults(); |       generalSettings->p->SetDefaults(); | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| #include <scwx/qt/settings/palette_settings.hpp> | #include <scwx/qt/settings/palette_settings.hpp> | ||||||
| #include <scwx/qt/util/json.hpp> | #include <scwx/qt/util/json.hpp> | ||||||
| 
 | #include <scwx/util/logger.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -10,7 +9,8 @@ namespace qt | ||||||
| namespace settings | 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<std::string> paletteNames_ = { | static const std::vector<std::string> paletteNames_ = { | ||||||
|    // Level 2 / Common Products
 |    // Level 2 / Common Products
 | ||||||
|  | @ -125,13 +125,11 @@ PaletteSettings::Load(const boost::json::value* json, bool& jsonDirty) | ||||||
|    { |    { | ||||||
|       if (json == nullptr) |       if (json == nullptr) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Key is not present, resetting to defaults"); | ||||||
|             << logPrefix_ << "Key is not present, resetting to defaults"; |  | ||||||
|       } |       } | ||||||
|       else if (!json->is_object()) |       else if (!json->is_object()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid json, resetting to defaults"); | ||||||
|             << logPrefix_ << "Invalid json, resetting to defaults"; |  | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       generalSettings->p->SetDefaults(); |       generalSettings->p->SetDefaults(); | ||||||
|  |  | ||||||
|  | @ -3,8 +3,6 @@ | ||||||
| #include <scwx/common/sites.hpp> | #include <scwx/common/sites.hpp> | ||||||
| #include <scwx/util/time.hpp> | #include <scwx/util/time.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -12,8 +10,7 @@ namespace qt | ||||||
| namespace types | namespace types | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::qt::types::radar_product_record"; | ||||||
|    "[scwx::qt::types::radar_product_record] "; |  | ||||||
| 
 | 
 | ||||||
| class RadarProductRecordImpl | class RadarProductRecordImpl | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -2,11 +2,11 @@ | ||||||
| #define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING | #define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING | ||||||
| 
 | 
 | ||||||
| #include <scwx/qt/util/font.hpp> | #include <scwx/qt/util/font.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <codecvt> | #include <codecvt> | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
| #include <QFile> | #include <QFile> | ||||||
| #include <QFileInfo> | #include <QFileInfo> | ||||||
|  | @ -76,7 +76,8 @@ static const std::string CODEPOINTS = | ||||||
|    "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" |    "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" | ||||||
|    "`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 BASE_POINT_SIZE = 72.0f; | ||||||
| static constexpr float POINT_SCALE     = 1.0f / BASE_POINT_SIZE; | static constexpr float POINT_SCALE     = 1.0f / BASE_POINT_SIZE; | ||||||
|  | @ -144,9 +145,8 @@ float Font::BufferText(std::shared_ptr<FontBuffer> buffer, | ||||||
|       auto it = p->glyphs_.find(c); |       auto it = p->glyphs_.find(c); | ||||||
|       if (it == p->glyphs_.end()) |       if (it == p->glyphs_.end()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(info) |          logger_->info("Could not draw character: {}", | ||||||
|             << logPrefix_ |                        static_cast<uint32_t>(c)); | ||||||
|             << "Could not draw character: " << static_cast<uint32_t>(c); |  | ||||||
|          continue; |          continue; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  | @ -198,9 +198,7 @@ float Font::TextLength(const std::string& text, float pointSize) const | ||||||
|       auto it = p->glyphs_.find(c); |       auto it = p->glyphs_.find(c); | ||||||
|       if (it == p->glyphs_.end()) |       if (it == p->glyphs_.end()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(info) |          logger_->info("Character not found: {}", static_cast<uint32_t>(c)); | ||||||
|             << logPrefix_ |  | ||||||
|             << "Character not found: " << static_cast<uint32_t>(c); |  | ||||||
|          continue; |          continue; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  | @ -242,7 +240,7 @@ GLuint Font::GenerateTexture(gl::OpenGLFunctions& gl) | ||||||
| 
 | 
 | ||||||
| std::shared_ptr<Font> Font::Create(const std::string& resource) | std::shared_ptr<Font> 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>   font = nullptr; |    std::shared_ptr<Font>   font = nullptr; | ||||||
|    boost::timer::cpu_timer timer; |    boost::timer::cpu_timer timer; | ||||||
|  | @ -250,7 +248,7 @@ std::shared_ptr<Font> Font::Create(const std::string& resource) | ||||||
|    auto it = fontMap_.find(resource); |    auto it = fontMap_.find(resource); | ||||||
|    if (it != fontMap_.end()) |    if (it != fontMap_.end()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Font already created"; |       logger_->debug("Font already created"); | ||||||
|       return it->second; |       return it->second; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -258,7 +256,7 @@ std::shared_ptr<Font> Font::Create(const std::string& resource) | ||||||
|    fontFile.open(QIODevice::ReadOnly); |    fontFile.open(QIODevice::ReadOnly); | ||||||
|    if (!fontFile.isOpen()) |    if (!fontFile.isOpen()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(error) << logPrefix_ << "Could not read font file"; |       logger_->error("Could not read font file"); | ||||||
|       return font; |       return font; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -298,8 +296,7 @@ std::shared_ptr<Font> Font::Create(const std::string& resource) | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Font loaded in {}", timer.format(6, "%ws")); | ||||||
|       << logPrefix_ << "Font loaded in " << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    texture_font_delete(textureFont); |    texture_font_delete(textureFont); | ||||||
| 
 | 
 | ||||||
|  | @ -337,9 +334,8 @@ void FontImpl::ParseNames(FT_Face face) | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug( | ||||||
|       << logPrefix_ << "Font family: " << fontData_.fontFamily_ << " (" |       "Font family: {} ({})", fontData_.fontFamily_, fontData_.fontSubfamily_); | ||||||
|       << fontData_.fontSubfamily_ << ")"; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void ParseSfntName(const FT_SfntName& sfntName, std::string& str) | static void ParseSfntName(const FT_SfntName& sfntName, std::string& str) | ||||||
|  |  | ||||||
|  | @ -1,9 +1,8 @@ | ||||||
| #include <scwx/qt/util/font_buffer.hpp> | #include <scwx/qt/util/font_buffer.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <mutex> | #include <mutex> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -11,7 +10,8 @@ namespace qt | ||||||
| namespace util | 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 | class FontBufferImpl | ||||||
| { | { | ||||||
|  | @ -140,8 +140,7 @@ void FontBuffer::Push(std::initializer_list<GLuint>  indices, | ||||||
| { | { | ||||||
|    if (indices.size() % 3 != 0 || vertices.size() % 9 != 0) |    if (indices.size() % 3 != 0 || vertices.size() % 9 != 0) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid push arguments, ignoring"); | ||||||
|          << logPrefix_ << "Invalid push arguments, ignoring"; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,8 +1,8 @@ | ||||||
| #include <scwx/qt/util/json.hpp> | #include <scwx/qt/util/json.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <fstream> | #include <fstream> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <QFile> | #include <QFile> | ||||||
| #include <QTextStream> | #include <QTextStream> | ||||||
| 
 | 
 | ||||||
|  | @ -15,7 +15,8 @@ namespace util | ||||||
| namespace json | 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:
 | /* Adapted from:
 | ||||||
|  * https://www.boost.org/doc/libs/1_77_0/libs/json/doc/html/json/examples.html#json.examples.pretty
 |  * 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) |          if (minValue.has_value() && value < *minValue) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("{} less than minimum ({} < {}), setting to: {2}", | ||||||
|                << logPrefix_ << key << " less than minimum (" << value << " < " |                           key, | ||||||
|                << *minValue << "), setting to: " << *minValue; |                           value, | ||||||
|  |                           *minValue); | ||||||
|             value = *minValue; |             value = *minValue; | ||||||
|          } |          } | ||||||
|          else if (maxValue.has_value() && value > *maxValue) |          else if (maxValue.has_value() && value > *maxValue) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("{} greater than maximum ({} > {}), setting to: {2}", | ||||||
|                << logPrefix_ << key << " greater than maximum (" << value |                           key, | ||||||
|                << " > " << *maxValue << "), setting to: " << *maxValue; |                           value, | ||||||
|  |                           *maxValue); | ||||||
|             value = *maxValue; |             value = *maxValue; | ||||||
|          } |          } | ||||||
|          else |          else | ||||||
|  | @ -69,17 +72,17 @@ bool FromJsonInt64(const boost::json::object& json, | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("{} is not an int64 ({}), setting to default: {}", | ||||||
|             << logPrefix_ << key << " is not an int64 (" << jv->kind() |                        key, | ||||||
|             << "), setting to default:" << defaultValue; |                        jv->kind(), | ||||||
|  |                        defaultValue); | ||||||
|          value = defaultValue; |          value = defaultValue; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug( | ||||||
|          << logPrefix_ << key |          "{} is not present, setting to default: {}", key, defaultValue); | ||||||
|          << " is not present, setting to default: " << defaultValue; |  | ||||||
|       value = defaultValue; |       value = defaultValue; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -103,17 +106,15 @@ bool FromJsonString(const boost::json::object& json, | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn( | ||||||
|             << logPrefix_ << key |             "{} is not a string, setting to default: {}", key, defaultValue); | ||||||
|             << " is not a string, setting to default: " << defaultValue; |  | ||||||
|          value = defaultValue; |          value = defaultValue; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug( | ||||||
|          << logPrefix_ << key |          "{} is not present, setting to default: {}", key, defaultValue); | ||||||
|          << " is not present, setting to default: " << defaultValue; |  | ||||||
|       value = defaultValue; |       value = defaultValue; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -156,9 +157,8 @@ static boost::json::value ReadJsonFile(QFile& file) | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not open file for reading: \"{}\"", | ||||||
|          << logPrefix_ << "Could not open file for reading: \"" |                     file.fileName().toStdString()); | ||||||
|          << file.fileName().toStdString() << "\""; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return json; |    return json; | ||||||
|  | @ -176,7 +176,7 @@ static boost::json::value ReadJsonStream(std::istream& is) | ||||||
|       p.write(line, ec); |       p.write(line, ec); | ||||||
|       if (ec) |       if (ec) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) << logPrefix_ << ec.message(); |          logger_->warn("{}", ec.message()); | ||||||
|          return nullptr; |          return nullptr; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -184,7 +184,7 @@ static boost::json::value ReadJsonStream(std::istream& is) | ||||||
|    p.finish(ec); |    p.finish(ec); | ||||||
|    if (ec) |    if (ec) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << ec.message(); |       logger_->warn("{}", ec.message()); | ||||||
|       return nullptr; |       return nullptr; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -199,8 +199,7 @@ void WriteJsonFile(const std::string&        path, | ||||||
| 
 | 
 | ||||||
|    if (!ofs.is_open()) |    if (!ofs.is_open()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Cannot write JSON file: \"{}\"", path); | ||||||
|          << logPrefix_ << "Cannot write JSON file: \"" << path << "\""; |  | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|  | @ -277,11 +276,17 @@ static void PrettyPrintJson(std::ostream&             os, | ||||||
|       break; |       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_: |    case boost::json::kind::bool_: | ||||||
|       if (jv.get_bool()) |       if (jv.get_bool()) | ||||||
|  | @ -290,7 +295,9 @@ static void PrettyPrintJson(std::ostream&             os, | ||||||
|          os << "false"; |          os << "false"; | ||||||
|       break; |       break; | ||||||
| 
 | 
 | ||||||
|    case boost::json::kind::null: os << "null"; break; |    case boost::json::kind::null: | ||||||
|  |       os << "null"; | ||||||
|  |       break; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (indent->empty()) |    if (indent->empty()) | ||||||
|  |  | ||||||
|  | @ -1,9 +1,9 @@ | ||||||
| #include <scwx/qt/view/level2_product_view.hpp> | #include <scwx/qt/view/level2_product_view.hpp> | ||||||
| #include <scwx/common/constants.hpp> | #include <scwx/common/constants.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/threads.hpp> | #include <scwx/util/threads.hpp> | ||||||
| #include <scwx/util/time.hpp> | #include <scwx/util/time.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <boost/range/irange.hpp> | #include <boost/range/irange.hpp> | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
| 
 | 
 | ||||||
|  | @ -14,7 +14,8 @@ namespace qt | ||||||
| namespace view | 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 uint16_t RANGE_FOLDED      = 1u; | ||||||
| static constexpr uint32_t VERTICES_PER_BIN  = 6u; | static constexpr uint32_t VERTICES_PER_BIN  = 6u; | ||||||
|  | @ -73,8 +74,8 @@ public: | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Unknown product: \"" |          logger_->warn("Unknown product: \"{}\"", | ||||||
|                                     << common::GetLevel2Name(product) << "\""; |                        common::GetLevel2Name(product)); | ||||||
|          dataBlockType_ = wsr88d::rda::DataBlockType::Unknown; |          dataBlockType_ = wsr88d::rda::DataBlockType::Unknown; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -347,7 +348,7 @@ void Level2ProductView::UpdateColorTable() | ||||||
| 
 | 
 | ||||||
| void Level2ProductView::ComputeSweep() | void Level2ProductView::ComputeSweep() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; |    logger_->debug("ComputeSweep()"); | ||||||
| 
 | 
 | ||||||
|    boost::timer::cpu_timer timer; |    boost::timer::cpu_timer timer; | ||||||
| 
 | 
 | ||||||
|  | @ -382,8 +383,8 @@ void Level2ProductView::ComputeSweep() | ||||||
| 
 | 
 | ||||||
|    if (momentData0 == nullptr) |    if (momentData0 == nullptr) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "No moment data for " |       logger_->warn("No moment data for {}", | ||||||
|                                  << common::GetLevel2Name(p->product_); |                     common::GetLevel2Name(p->product_)); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -462,8 +463,7 @@ void Level2ProductView::ComputeSweep() | ||||||
| 
 | 
 | ||||||
|       if (momentData0->data_word_size() != momentData->data_word_size()) |       if (momentData0->data_word_size() != momentData->data_word_size()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Radial {} has different word size", radial); | ||||||
|             << logPrefix_ << "Radial " << radial << " has different word size"; |  | ||||||
|          continue; |          continue; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  | @ -632,8 +632,7 @@ void Level2ProductView::ComputeSweep() | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); | ||||||
|       << logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    UpdateColorTable(); |    UpdateColorTable(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| #include <scwx/wsr88d/rpg/graphic_product_message.hpp> | #include <scwx/wsr88d/rpg/graphic_product_message.hpp> | ||||||
| #include <scwx/wsr88d/rpg/radial_data_packet.hpp> | #include <scwx/wsr88d/rpg/radial_data_packet.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <boost/range/irange.hpp> | #include <boost/range/irange.hpp> | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
| 
 | 
 | ||||||
|  | @ -17,7 +16,7 @@ namespace qt | ||||||
| namespace view | 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; | static constexpr uint16_t RANGE_FOLDED = 1u; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,11 +1,11 @@ | ||||||
| #include <scwx/qt/view/level3_radial_view.hpp> | #include <scwx/qt/view/level3_radial_view.hpp> | ||||||
| #include <scwx/common/constants.hpp> | #include <scwx/common/constants.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/threads.hpp> | #include <scwx/util/threads.hpp> | ||||||
| #include <scwx/util/time.hpp> | #include <scwx/util/time.hpp> | ||||||
| #include <scwx/wsr88d/rpg/digital_radial_data_array_packet.hpp> | #include <scwx/wsr88d/rpg/digital_radial_data_array_packet.hpp> | ||||||
| #include <scwx/wsr88d/rpg/radial_data_packet.hpp> | #include <scwx/wsr88d/rpg/radial_data_packet.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <boost/range/irange.hpp> | #include <boost/range/irange.hpp> | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
| 
 | 
 | ||||||
|  | @ -16,7 +16,8 @@ namespace qt | ||||||
| namespace view | 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 uint16_t RANGE_FOLDED      = 1u; | ||||||
| static constexpr uint32_t VERTICES_PER_BIN  = 6u; | 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() | void Level3RadialView::ComputeSweep() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; |    logger_->debug("ComputeSweep()"); | ||||||
| 
 | 
 | ||||||
|    boost::timer::cpu_timer timer; |    boost::timer::cpu_timer timer; | ||||||
| 
 | 
 | ||||||
|  | @ -120,8 +121,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|       std::dynamic_pointer_cast<wsr88d::rpg::GraphicProductMessage>(message); |       std::dynamic_pointer_cast<wsr88d::rpg::GraphicProductMessage>(message); | ||||||
|    if (gpm == nullptr) |    if (gpm == nullptr) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Graphic Product Message not found"); | ||||||
|          << logPrefix_ << "Graphic Product Message not found"; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|    else if (gpm == graphic_product_message()) |    else if (gpm == graphic_product_message()) | ||||||
|  | @ -139,7 +139,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|       gpm->symbology_block(); |       gpm->symbology_block(); | ||||||
|    if (descriptionBlock == nullptr || symbologyBlock == nullptr) |    if (descriptionBlock == nullptr || symbologyBlock == nullptr) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Missing blocks"; |       logger_->warn("Missing blocks"); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -147,8 +147,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    uint16_t numberOfLayers = symbologyBlock->number_of_layers(); |    uint16_t numberOfLayers = symbologyBlock->number_of_layers(); | ||||||
|    if (numberOfLayers < 1) |    if (numberOfLayers < 1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("No layers present in symbology block"); | ||||||
|          << logPrefix_ << "No layers present in symbology block"; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -199,7 +198,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No radial data found"; |       logger_->debug("No radial data found"); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -207,8 +206,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    const size_t radials = radialData->number_of_radials(); |    const size_t radials = radialData->number_of_radials(); | ||||||
|    if (radials != 360 && radials != 720) |    if (radials != 360 && radials != 720) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Unsupported number of radials: {}", radials); | ||||||
|          << logPrefix_ << "Unsupported number of radials: " << radials; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -223,8 +221,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    const uint16_t gates = radialData->number_of_range_bins(); |    const uint16_t gates = radialData->number_of_range_bins(); | ||||||
|    if (gates < 1) |    if (gates < 1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("No range bins in radial data"); | ||||||
|          << logPrefix_ << "No range bins in radial data"; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -368,8 +365,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    dataMoments8.shrink_to_fit(); |    dataMoments8.shrink_to_fit(); | ||||||
| 
 | 
 | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); | ||||||
|       << logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    UpdateColorTable(); |    UpdateColorTable(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| #include <scwx/qt/view/level3_raster_view.hpp> | #include <scwx/qt/view/level3_raster_view.hpp> | ||||||
| #include <scwx/common/constants.hpp> | #include <scwx/common/constants.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/threads.hpp> | #include <scwx/util/threads.hpp> | ||||||
| #include <scwx/util/time.hpp> | #include <scwx/util/time.hpp> | ||||||
| #include <scwx/wsr88d/rpg/raster_data_packet.hpp> | #include <scwx/wsr88d/rpg/raster_data_packet.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <boost/range/irange.hpp> | #include <boost/range/irange.hpp> | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
| #include <GeographicLib/Geodesic.hpp> | #include <GeographicLib/Geodesic.hpp> | ||||||
|  | @ -16,7 +16,8 @@ namespace qt | ||||||
| namespace view | 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 uint16_t RANGE_FOLDED      = 1u; | ||||||
| static constexpr uint32_t VERTICES_PER_BIN  = 6u; | 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() | void Level3RasterView::ComputeSweep() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; |    logger_->debug("ComputeSweep()"); | ||||||
| 
 | 
 | ||||||
|    boost::timer::cpu_timer timer; |    boost::timer::cpu_timer timer; | ||||||
| 
 | 
 | ||||||
|  | @ -120,8 +121,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|       std::dynamic_pointer_cast<wsr88d::rpg::GraphicProductMessage>(message); |       std::dynamic_pointer_cast<wsr88d::rpg::GraphicProductMessage>(message); | ||||||
|    if (gpm == nullptr) |    if (gpm == nullptr) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Graphic Product Message not found"); | ||||||
|          << logPrefix_ << "Graphic Product Message not found"; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|    else if (gpm == graphic_product_message()) |    else if (gpm == graphic_product_message()) | ||||||
|  | @ -139,7 +139,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|       gpm->symbology_block(); |       gpm->symbology_block(); | ||||||
|    if (descriptionBlock == nullptr || symbologyBlock == nullptr) |    if (descriptionBlock == nullptr || symbologyBlock == nullptr) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Missing blocks"; |       logger_->warn("Missing blocks"); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -147,8 +147,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|    uint16_t numberOfLayers = symbologyBlock->number_of_layers(); |    uint16_t numberOfLayers = symbologyBlock->number_of_layers(); | ||||||
|    if (numberOfLayers < 1) |    if (numberOfLayers < 1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("No layers present in symbology block"); | ||||||
|          << logPrefix_ << "No layers present in symbology block"; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -179,7 +178,7 @@ void Level3RasterView::ComputeSweep() | ||||||
| 
 | 
 | ||||||
|    if (rasterData == nullptr) |    if (rasterData == nullptr) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No raster data found"; |       logger_->debug("No raster data found"); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -193,7 +192,7 @@ void Level3RasterView::ComputeSweep() | ||||||
| 
 | 
 | ||||||
|    if (maxColumns == 0) |    if (maxColumns == 0) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No raster bins found"; |       logger_->debug("No raster bins found"); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -256,8 +255,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|       }); |       }); | ||||||
| 
 | 
 | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws")); | ||||||
|       << logPrefix_ << "Coordinates calculated in " << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    // Calculate vertices
 |    // Calculate vertices
 | ||||||
|    timer.start(); |    timer.start(); | ||||||
|  | @ -332,8 +330,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|    dataMoments8.shrink_to_fit(); |    dataMoments8.shrink_to_fit(); | ||||||
| 
 | 
 | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); | ||||||
|       << logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    UpdateColorTable(); |    UpdateColorTable(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| #include <scwx/qt/view/radar_product_view.hpp> | #include <scwx/qt/view/radar_product_view.hpp> | ||||||
| #include <scwx/common/constants.hpp> | #include <scwx/common/constants.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <boost/range/irange.hpp> | #include <boost/range/irange.hpp> | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
| 
 | 
 | ||||||
|  | @ -12,7 +12,8 @@ namespace qt | ||||||
| namespace view | 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<boost::gil::rgba8_pixel_t> DEFAULT_COLOR_TABLE = { | static const std::vector<boost::gil::rgba8_pixel_t> DEFAULT_COLOR_TABLE = { | ||||||
|    boost::gil::rgba8_pixel_t(0, 128, 0, 255), |    boost::gil::rgba8_pixel_t(0, 128, 0, 255), | ||||||
|  | @ -102,7 +103,7 @@ RadarProductView::GetCfpMomentData() const | ||||||
| 
 | 
 | ||||||
| void RadarProductView::ComputeSweep() | void RadarProductView::ComputeSweep() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; |    logger_->debug("ComputeSweep()"); | ||||||
| 
 | 
 | ||||||
|    emit SweepComputed(); |    emit SweepComputed(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -2,11 +2,10 @@ | ||||||
| #include <scwx/qt/view/level2_product_view.hpp> | #include <scwx/qt/view/level2_product_view.hpp> | ||||||
| #include <scwx/qt/view/level3_radial_view.hpp> | #include <scwx/qt/view/level3_radial_view.hpp> | ||||||
| #include <scwx/qt/view/level3_raster_view.hpp> | #include <scwx/qt/view/level3_raster_view.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <unordered_set> | #include <unordered_set> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -15,7 +14,8 @@ namespace view | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | 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<std::shared_ptr<RadarProductView>( | typedef std::function<std::shared_ptr<RadarProductView>( | ||||||
|    const std::string&                            productName, |    const std::string&                            productName, | ||||||
|  | @ -46,8 +46,7 @@ std::shared_ptr<RadarProductView> RadarProductViewFactory::Create( | ||||||
| 
 | 
 | ||||||
|       if (product == common::Level2Product::Unknown) |       if (product == common::Level2Product::Unknown) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Unknown Level 2 radar product: {}", productName); | ||||||
|             << logPrefix_ << "Unknown Level 2 radar product: " << productName; |  | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|  | @ -67,9 +66,8 @@ std::shared_ptr<RadarProductView> RadarProductViewFactory::Create( | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Unknown radar product group: {}", | ||||||
|          << logPrefix_ << "Unknown radar product group: " |                     common::GetRadarProductGroupName(productGroup)); | ||||||
|          << common::GetRadarProductGroupName(productGroup); |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return view; |    return view; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat