mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 20:20:05 +00:00 
			
		
		
		
	Merge branch 'feature/spdlog' into develop
This commit is contained in:
		
						commit
						2723ad1966
					
				
					 104 changed files with 780 additions and 946 deletions
				
			
		|  | @ -19,6 +19,7 @@ conan_cmake_configure(REQUIRES boost/1.78.0 | ||||||
|                                glm/0.9.9.8 |                                glm/0.9.9.8 | ||||||
|                                gtest/cci.20210126 |                                gtest/cci.20210126 | ||||||
|                                openssl/1.1.1n |                                openssl/1.1.1n | ||||||
|  |                                spdlog/1.10.0 | ||||||
|                                vulkan-loader/1.3.204.1 |                                vulkan-loader/1.3.204.1 | ||||||
|                       GENERATORS cmake |                       GENERATORS cmake | ||||||
|                                  cmake_find_package |                                  cmake_find_package | ||||||
|  |  | ||||||
|  | @ -206,10 +206,6 @@ qt6_create_translation_scwx(QM_FILES ${scwx-qt_SOURCE_DIR} ${TS_FILES}) | ||||||
| if (WIN32) | if (WIN32) | ||||||
|     target_compile_definitions(scwx-qt      PUBLIC WIN32_LEAN_AND_MEAN) |     target_compile_definitions(scwx-qt      PUBLIC WIN32_LEAN_AND_MEAN) | ||||||
|     target_compile_definitions(supercell-wx PUBLIC WIN32_LEAN_AND_MEAN) |     target_compile_definitions(supercell-wx PUBLIC WIN32_LEAN_AND_MEAN) | ||||||
| 
 |  | ||||||
|     # For Boost::log |  | ||||||
|     target_compile_definitions(scwx-qt      PRIVATE BOOST_USE_WINAPI_VERSION=0x0601) |  | ||||||
|     target_compile_definitions(supercell-wx PRIVATE BOOST_USE_WINAPI_VERSION=0x0601) |  | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| target_include_directories(scwx-qt PUBLIC ${scwx-qt_SOURCE_DIR}/source | target_include_directories(scwx-qt PUBLIC ${scwx-qt_SOURCE_DIR}/source | ||||||
|  |  | ||||||
|  | @ -1,11 +1,10 @@ | ||||||
| #include <scwx/qt/config/radar_site.hpp> | #include <scwx/qt/config/radar_site.hpp> | ||||||
| #include <scwx/qt/util/json.hpp> | #include <scwx/qt/util/json.hpp> | ||||||
| #include <scwx/common/sites.hpp> | #include <scwx/common/sites.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -13,7 +12,8 @@ namespace qt | ||||||
| namespace config | namespace config | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::settings::radar_site] "; | static const std::string logPrefix_ = "scwx::qt::settings::radar_site"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static const std::string defaultRadarSiteFile_ = | static const std::string defaultRadarSiteFile_ = | ||||||
|    ":/res/config/radar_sites.json"; |    ":/res/config/radar_sites.json"; | ||||||
|  | @ -121,8 +121,7 @@ void RadarSite::Initialize() | ||||||
| 
 | 
 | ||||||
| size_t RadarSite::ReadConfig(const std::string& path) | size_t RadarSite::ReadConfig(const std::string& path) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(info) << logPrefix_ << "Loading radar sites from \"" |    logger_->info("Loading radar sites from \"{}\"...", path); | ||||||
|                            << path << "\"..."; |  | ||||||
| 
 | 
 | ||||||
|    bool   dataValid  = true; |    bool   dataValid  = true; | ||||||
|    size_t sitesAdded = 0; |    size_t sitesAdded = 0; | ||||||
|  | @ -139,7 +138,7 @@ size_t RadarSite::ReadConfig(const std::string& path) | ||||||
| 
 | 
 | ||||||
|          if (!ValidateJsonEntry(o)) |          if (!ValidateJsonEntry(o)) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(info) << logPrefix_ << "Incorrect format: " << v; |             logger_->info("Incorrect format: {}", boost::json::serialize(v)); | ||||||
|          } |          } | ||||||
|          else |          else | ||||||
|          { |          { | ||||||
|  | @ -168,9 +167,9 @@ size_t RadarSite::ReadConfig(const std::string& path) | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                BOOST_LOG_TRIVIAL(warning) |                logger_->warn("Site ID conflict: {} and {}", | ||||||
|                   << logPrefix_ << "Site ID conflict: " << siteIdMap_.at(siteId) |                              siteIdMap_.at(siteId), | ||||||
|                   << " and " << site->p->id_; |                              site->p->id_); | ||||||
|             } |             } | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| #include <scwx/qt/gl/draw/draw_item.hpp> | #include <scwx/qt/gl/draw/draw_item.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> | #include <string> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -11,7 +11,7 @@ namespace gl | ||||||
| namespace draw | namespace draw | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::gl::draw::draw_item] "; | static const std::string logPrefix_ = "scwx::qt::gl::draw::draw_item"; | ||||||
| 
 | 
 | ||||||
| class DrawItemImpl | class DrawItemImpl | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -2,8 +2,6 @@ | ||||||
| 
 | 
 | ||||||
| #include <optional> | #include <optional> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -13,7 +11,7 @@ namespace gl | ||||||
| namespace draw | namespace draw | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::gl::draw::rectangle] "; | static const std::string logPrefix_ = "scwx::qt::gl::draw::rectangle"; | ||||||
| 
 | 
 | ||||||
| static constexpr size_t NUM_RECTANGLES         = 5; | static constexpr size_t NUM_RECTANGLES         = 5; | ||||||
| static constexpr size_t NUM_TRIANGLES          = NUM_RECTANGLES * 2; | static constexpr size_t NUM_TRIANGLES          = NUM_RECTANGLES * 2; | ||||||
|  |  | ||||||
|  | @ -7,8 +7,7 @@ | ||||||
|       GLenum err;                                                              \ |       GLenum err;                                                              \ | ||||||
|       while ((err = gl.glGetError()) != GL_NO_ERROR)                           \ |       while ((err = gl.glGetError()) != GL_NO_ERROR)                           \ | ||||||
|       {                                                                        \ |       {                                                                        \ | ||||||
|          BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "GL Error: " << err       \ |          logger_->error("GL Error: {}, {}: {}", err, __FILE__, __LINE__);      \ | ||||||
|                                     << ", " __FILE__ << ":" << __LINE__;       \ |  | ||||||
|       }                                                                        \ |       }                                                                        \ | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,9 +1,8 @@ | ||||||
| #include <scwx/qt/gl/shader_program.hpp> | #include <scwx/qt/gl/shader_program.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <QFile> | #include <QFile> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -11,7 +10,8 @@ namespace qt | ||||||
| namespace gl | namespace gl | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::gl::shader_program] "; | static const std::string logPrefix_ = "scwx::qt::gl::shader_program"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static constexpr GLsizei INFO_LOG_BUF_SIZE = 512; | static constexpr GLsizei INFO_LOG_BUF_SIZE = 512; | ||||||
| 
 | 
 | ||||||
|  | @ -53,8 +53,7 @@ GLuint ShaderProgram::id() const | ||||||
| bool ShaderProgram::Load(const std::string& vertexPath, | bool ShaderProgram::Load(const std::string& vertexPath, | ||||||
|                          const std::string& fragmentPath) |                          const std::string& fragmentPath) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Load(\"" << vertexPath << "\", \"" |    logger_->debug("Load: {}, {}", vertexPath, fragmentPath); | ||||||
|                             << fragmentPath << "\")"; |  | ||||||
| 
 | 
 | ||||||
|    OpenGLFunctions& gl = p->gl_; |    OpenGLFunctions& gl = p->gl_; | ||||||
| 
 | 
 | ||||||
|  | @ -71,15 +70,13 @@ bool ShaderProgram::Load(const std::string& vertexPath, | ||||||
| 
 | 
 | ||||||
|    if (!vertexFile.isOpen()) |    if (!vertexFile.isOpen()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(error) |       logger_->error("Could not load vertex shader: {}", vertexPath); | ||||||
|          << logPrefix_ << "Could not load vertex shader: " << vertexPath; |  | ||||||
|       return false; |       return false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (!fragmentFile.isOpen()) |    if (!fragmentFile.isOpen()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(error) |       logger_->error("Could not load fragment shader: {}", fragmentPath); | ||||||
|          << logPrefix_ << "Could not load fragment shader: " << fragmentPath; |  | ||||||
|       return false; |       return false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -108,14 +105,12 @@ bool ShaderProgram::Load(const std::string& vertexPath, | ||||||
|    gl.glGetShaderInfoLog(vertexShader, INFO_LOG_BUF_SIZE, &logLength, infoLog); |    gl.glGetShaderInfoLog(vertexShader, INFO_LOG_BUF_SIZE, &logLength, infoLog); | ||||||
|    if (!glSuccess) |    if (!glSuccess) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(error) |       logger_->error("Vertex shader compilation failed: {}", infoLog); | ||||||
|          << logPrefix_ << "Vertex shader compilation failed: " << infoLog; |  | ||||||
|       success = false; |       success = false; | ||||||
|    } |    } | ||||||
|    else if (logLength > 0) |    else if (logLength > 0) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(error) |       logger_->error("Vertex shader compiled with warnings: {}", infoLog); | ||||||
|          << logPrefix_ << "Vertex shader compiled with warnings: " << infoLog; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    // Create a fragment shader
 |    // Create a fragment shader
 | ||||||
|  | @ -131,14 +126,12 @@ bool ShaderProgram::Load(const std::string& vertexPath, | ||||||
|       fragmentShader, INFO_LOG_BUF_SIZE, &logLength, infoLog); |       fragmentShader, INFO_LOG_BUF_SIZE, &logLength, infoLog); | ||||||
|    if (!glSuccess) |    if (!glSuccess) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(error) |       logger_->error("Fragment shader compilation failed: {}", infoLog); | ||||||
|          << logPrefix_ << "Fragment shader compilation failed: " << infoLog; |  | ||||||
|       success = false; |       success = false; | ||||||
|    } |    } | ||||||
|    else if (logLength > 0) |    else if (logLength > 0) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(error) |       logger_->error("Fragment shader compiled with warnings: {}", infoLog); | ||||||
|          << logPrefix_ << "Fragment shader compiled with warnings: " << infoLog; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (success) |    if (success) | ||||||
|  | @ -152,14 +145,12 @@ bool ShaderProgram::Load(const std::string& vertexPath, | ||||||
|       gl.glGetProgramInfoLog(p->id_, INFO_LOG_BUF_SIZE, &logLength, infoLog); |       gl.glGetProgramInfoLog(p->id_, INFO_LOG_BUF_SIZE, &logLength, infoLog); | ||||||
|       if (!glSuccess) |       if (!glSuccess) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(error) |          logger_->error("Shader program link failed: {}", infoLog); | ||||||
|             << logPrefix_ << "Shader program link failed: " << infoLog; |  | ||||||
|          success = false; |          success = false; | ||||||
|       } |       } | ||||||
|       else if (logLength > 0) |       else if (logLength > 0) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(error) |          logger_->error("Shader program linked with warnings: {}", infoLog); | ||||||
|             << logPrefix_ << "Shader program linked with warnings: " << infoLog; |  | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| #include <scwx/qt/gl/text_shader.hpp> | #include <scwx/qt/gl/text_shader.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <glm/gtc/type_ptr.hpp> | #include <glm/gtc/type_ptr.hpp> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
|  | @ -10,7 +10,8 @@ namespace qt | ||||||
| namespace gl | namespace gl | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::gl::text_shader] "; | static const std::string logPrefix_ = "scwx::qt::gl::text_shader"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class TextShaderImpl | class TextShaderImpl | ||||||
| { | { | ||||||
|  | @ -46,7 +47,7 @@ bool TextShader::Initialize() | ||||||
|    p->projectionLocation_ = gl.glGetUniformLocation(id(), "projection"); |    p->projectionLocation_ = gl.glGetUniformLocation(id(), "projection"); | ||||||
|    if (p->projectionLocation_ == -1) |    if (p->projectionLocation_ == -1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find projection"; |       logger_->warn("Could not find projection"); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return success; |    return success; | ||||||
|  |  | ||||||
|  | @ -2,15 +2,15 @@ | ||||||
| #include <scwx/qt/main/main_window.hpp> | #include <scwx/qt/main/main_window.hpp> | ||||||
| #include <scwx/qt/manager/resource_manager.hpp> | #include <scwx/qt/manager/resource_manager.hpp> | ||||||
| #include <scwx/qt/manager/settings_manager.hpp> | #include <scwx/qt/manager/settings_manager.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/expressions.hpp> | #include <spdlog/spdlog.h> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <QApplication> | #include <QApplication> | ||||||
| 
 | 
 | ||||||
| int main(int argc, char* argv[]) | int main(int argc, char* argv[]) | ||||||
| { | { | ||||||
|    boost::log::core::get()->set_filter(boost::log::trivial::severity >= |    scwx::util::Logger::Initialize(); | ||||||
|                                        boost::log::trivial::debug); |    spdlog::set_level(spdlog::level::debug); | ||||||
| 
 | 
 | ||||||
|    QCoreApplication::setApplicationName("Supercell Wx"); |    QCoreApplication::setApplicationName("Supercell Wx"); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,6 +10,7 @@ | ||||||
| #include <scwx/common/characters.hpp> | #include <scwx/common/characters.hpp> | ||||||
| #include <scwx/common/products.hpp> | #include <scwx/common/products.hpp> | ||||||
| #include <scwx/common/vcp.hpp> | #include <scwx/common/vcp.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <QFileDialog> | #include <QFileDialog> | ||||||
| #include <QMessageBox> | #include <QMessageBox> | ||||||
|  | @ -17,8 +18,6 @@ | ||||||
| #include <QStandardPaths> | #include <QStandardPaths> | ||||||
| #include <QToolButton> | #include <QToolButton> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -26,7 +25,8 @@ namespace qt | ||||||
| namespace main | namespace main | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::main::main_window] "; | static const std::string logPrefix_ = "scwx::qt::main::main_window"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class MainWindowImpl : public QObject | class MainWindowImpl : public QObject | ||||||
| { | { | ||||||
|  | @ -51,10 +51,9 @@ public: | ||||||
|       { |       { | ||||||
|          if (!std::filesystem::create_directories(appDataPath)) |          if (!std::filesystem::create_directories(appDataPath)) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(error) |             logger_->error( | ||||||
|                << logPrefix_ |                "Unable to create application local data directory: \"{}\"", | ||||||
|                << "Unable to create application local data directory: \"" |                appDataPath); | ||||||
|                << appDataPath << "\""; |  | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  | @ -253,7 +252,7 @@ void MainWindow::on_actionOpen_triggered() | ||||||
|       this, |       this, | ||||||
|       [=](const QString& file) |       [=](const QString& file) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(info) << "Selected: " << file.toStdString(); |          logger_->info("Selected: {}", file.toStdString()); | ||||||
| 
 | 
 | ||||||
|          std::shared_ptr<request::NexradFileRequest> request = |          std::shared_ptr<request::NexradFileRequest> request = | ||||||
|             std::make_shared<request::NexradFileRequest>(); |             std::make_shared<request::NexradFileRequest>(); | ||||||
|  | @ -397,8 +396,7 @@ void MainWindowImpl::SelectRadarProduct(map::MapWidget*       mapWidget, | ||||||
| { | { | ||||||
|    const std::string& productName = common::GetLevel2Name(product); |    const std::string& productName = common::GetLevel2Name(product); | ||||||
| 
 | 
 | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Selecting Level 2 radar product: {}", productName); | ||||||
|       << logPrefix_ << "Selecting Level 2 radar product: " << productName; |  | ||||||
| 
 | 
 | ||||||
|    if (mapWidget == activeMap_) |    if (mapWidget == activeMap_) | ||||||
|    { |    { | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| #include <scwx/qt/manager/radar_product_manager.hpp> | #include <scwx/qt/manager/radar_product_manager.hpp> | ||||||
| #include <scwx/common/constants.hpp> | #include <scwx/common/constants.hpp> | ||||||
| #include <scwx/util/threads.hpp> | #include <scwx/util/threads.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/wsr88d/nexrad_file_factory.hpp> | #include <scwx/wsr88d/nexrad_file_factory.hpp> | ||||||
| 
 | 
 | ||||||
| #include <deque> | #include <deque> | ||||||
|  | @ -8,7 +9,6 @@ | ||||||
| #include <mutex> | #include <mutex> | ||||||
| #include <shared_mutex> | #include <shared_mutex> | ||||||
| 
 | 
 | ||||||
| #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> | ||||||
|  | @ -22,7 +22,8 @@ namespace manager | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::qt::manager::radar_product_manager] "; |    "scwx::qt::manager::radar_product_manager"; | ||||||
|  | static const auto logger_ = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| typedef std::function<std::shared_ptr<wsr88d::NexradFile>()> | typedef std::function<std::shared_ptr<wsr88d::NexradFile>()> | ||||||
|    CreateNexradFileFunction; |    CreateNexradFileFunction; | ||||||
|  | @ -59,8 +60,7 @@ public: | ||||||
|    { |    { | ||||||
|       if (radarSite_ == nullptr) |       if (radarSite_ == nullptr) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Radar site not found: \"{}\"", radarId_); | ||||||
|             << logPrefix_ << "Radar site not found: \"" << radarId_ << "\""; |  | ||||||
|          radarSite_ = std::make_shared<config::RadarSite>(); |          radarSite_ = std::make_shared<config::RadarSite>(); | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -130,7 +130,7 @@ void RadarProductManager::Initialize() | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()"; |    logger_->debug("Initialize()"); | ||||||
| 
 | 
 | ||||||
|    boost::timer::cpu_timer timer; |    boost::timer::cpu_timer timer; | ||||||
| 
 | 
 | ||||||
|  | @ -176,9 +176,8 @@ void RadarProductManager::Initialize() | ||||||
|          coordinates0_5Degree[offset + 1] = longitude; |          coordinates0_5Degree[offset + 1] = longitude; | ||||||
|       }); |       }); | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Coordinates (0.5 degree) calculated in {}", | ||||||
|       << logPrefix_ << "Coordinates (0.5 degree) calculated in " |                   timer.format(6, "%ws")); | ||||||
|       << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    // Calculate 1 degree azimuth coordinates
 |    // Calculate 1 degree azimuth coordinates
 | ||||||
|    timer.start(); |    timer.start(); | ||||||
|  | @ -214,9 +213,8 @@ void RadarProductManager::Initialize() | ||||||
|          coordinates1Degree[offset + 1] = longitude; |          coordinates1Degree[offset + 1] = longitude; | ||||||
|       }); |       }); | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Coordinates (1 degree) calculated in {}", | ||||||
|       << logPrefix_ << "Coordinates (1 degree) calculated in " |                   timer.format(6, "%ws")); | ||||||
|       << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    p->initialized_ = true; |    p->initialized_ = true; | ||||||
| } | } | ||||||
|  | @ -224,7 +222,7 @@ void RadarProductManager::Initialize() | ||||||
| void RadarProductManager::LoadData( | void RadarProductManager::LoadData( | ||||||
|    std::istream& is, std::shared_ptr<request::NexradFileRequest> request) |    std::istream& is, std::shared_ptr<request::NexradFileRequest> request) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadData()"; |    logger_->debug("LoadData()"); | ||||||
| 
 | 
 | ||||||
|    RadarProductManagerImpl::LoadNexradFile( |    RadarProductManagerImpl::LoadNexradFile( | ||||||
|       [=, &is]() -> std::shared_ptr<wsr88d::NexradFile> |       [=, &is]() -> std::shared_ptr<wsr88d::NexradFile> | ||||||
|  | @ -236,7 +234,7 @@ void RadarProductManager::LoadFile( | ||||||
|    const std::string&                          filename, |    const std::string&                          filename, | ||||||
|    std::shared_ptr<request::NexradFileRequest> request) |    std::shared_ptr<request::NexradFileRequest> request) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")"; |    logger_->debug("LoadFile: {}", filename); | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<types::RadarProductRecord> existingRecord = nullptr; |    std::shared_ptr<types::RadarProductRecord> existingRecord = nullptr; | ||||||
| 
 | 
 | ||||||
|  | @ -245,8 +243,7 @@ void RadarProductManager::LoadFile( | ||||||
|       auto             it = fileIndex_.find(filename); |       auto             it = fileIndex_.find(filename); | ||||||
|       if (it != fileIndex_.cend()) |       if (it != fileIndex_.cend()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) |          logger_->debug("File previously loaded, loading from file cache"); | ||||||
|             << logPrefix_ << "File previously loaded, loading from file cache"; |  | ||||||
| 
 | 
 | ||||||
|          existingRecord = it->second; |          existingRecord = it->second; | ||||||
|       } |       } | ||||||
|  | @ -385,7 +382,7 @@ std::shared_ptr<types::RadarProductRecord> | ||||||
| RadarProductManagerImpl::StoreRadarProductRecord( | RadarProductManagerImpl::StoreRadarProductRecord( | ||||||
|    std::shared_ptr<types::RadarProductRecord> record) |    std::shared_ptr<types::RadarProductRecord> record) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "StoreRadarProductRecord()"; |    logger_->debug("StoreRadarProductRecord()"); | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<types::RadarProductRecord> storedRecord = record; |    std::shared_ptr<types::RadarProductRecord> storedRecord = record; | ||||||
| 
 | 
 | ||||||
|  | @ -394,9 +391,8 @@ RadarProductManagerImpl::StoreRadarProductRecord( | ||||||
|       auto it = level2ProductRecords_.find(record->time()); |       auto it = level2ProductRecords_.find(record->time()); | ||||||
|       if (it != level2ProductRecords_.cend()) |       if (it != level2ProductRecords_.cend()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) |          logger_->debug( | ||||||
|             << logPrefix_ |             "Level 2 product previously loaded, loading from cache"); | ||||||
|             << "Level 2 product previously loaded, loading from cache"; |  | ||||||
| 
 | 
 | ||||||
|          storedRecord = it->second; |          storedRecord = it->second; | ||||||
|       } |       } | ||||||
|  | @ -412,9 +408,8 @@ RadarProductManagerImpl::StoreRadarProductRecord( | ||||||
|       auto it = productMap.find(record->time()); |       auto it = productMap.find(record->time()); | ||||||
|       if (it != productMap.cend()) |       if (it != productMap.cend()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) |          logger_->debug( | ||||||
|             << logPrefix_ |             "Level 3 product previously loaded, loading from cache"); | ||||||
|             << "Level 3 product previously loaded, loading from cache"; |  | ||||||
| 
 | 
 | ||||||
|          storedRecord = it->second; |          storedRecord = it->second; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| #include <scwx/qt/manager/settings_manager.hpp> | #include <scwx/qt/manager/settings_manager.hpp> | ||||||
| #include <scwx/qt/util/json.hpp> | #include <scwx/qt/util/json.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <filesystem> | #include <filesystem> | ||||||
| #include <fstream> | #include <fstream> | ||||||
|  | @ -7,8 +8,6 @@ | ||||||
| #include <QDir> | #include <QDir> | ||||||
| #include <QStandardPaths> | #include <QStandardPaths> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -18,7 +17,8 @@ namespace manager | ||||||
| namespace SettingsManager | namespace SettingsManager | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::manager::settings_manager] "; | static const std::string logPrefix_ = "scwx::qt::manager::settings_manager"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static std::shared_ptr<settings::GeneralSettings> generalSettings_ = nullptr; | static std::shared_ptr<settings::GeneralSettings> generalSettings_ = nullptr; | ||||||
| static std::shared_ptr<settings::PaletteSettings> paletteSettings_ = nullptr; | static std::shared_ptr<settings::PaletteSettings> paletteSettings_ = nullptr; | ||||||
|  | @ -37,9 +37,8 @@ void Initialize() | ||||||
|    { |    { | ||||||
|       if (!std::filesystem::create_directories(appDataPath)) |       if (!std::filesystem::create_directories(appDataPath)) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(error) |          logger_->error("Unable to create application data directory: \"{}\"", | ||||||
|             << logPrefix_ << "Unable to create application data directory: \"" |                         appDataPath); | ||||||
|             << appDataPath << "\""; |  | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -97,7 +96,7 @@ static boost::json::value ConvertSettingsToJson() | ||||||
| 
 | 
 | ||||||
| static void GenerateDefaultSettings() | static void GenerateDefaultSettings() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(info) << logPrefix_ << "Generating default settings"; |    logger_->info("Generating default settings"); | ||||||
| 
 | 
 | ||||||
|    generalSettings_ = settings::GeneralSettings::Create(); |    generalSettings_ = settings::GeneralSettings::Create(); | ||||||
|    paletteSettings_ = settings::PaletteSettings::Create(); |    paletteSettings_ = settings::PaletteSettings::Create(); | ||||||
|  | @ -105,7 +104,7 @@ static void GenerateDefaultSettings() | ||||||
| 
 | 
 | ||||||
| static bool LoadSettings(const boost::json::object& settingsJson) | static bool LoadSettings(const boost::json::object& settingsJson) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(info) << logPrefix_ << "Loading settings"; |    logger_->info("Loading settings"); | ||||||
| 
 | 
 | ||||||
|    bool jsonDirty = false; |    bool jsonDirty = false; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| #include <scwx/qt/map/color_table_layer.hpp> | #include <scwx/qt/map/color_table_layer.hpp> | ||||||
| #include <scwx/qt/gl/shader_program.hpp> | #include <scwx/qt/gl/shader_program.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <glm/glm.hpp> | #include <glm/glm.hpp> | ||||||
| #include <glm/gtc/type_ptr.hpp> | #include <glm/gtc/type_ptr.hpp> | ||||||
| 
 | 
 | ||||||
|  | @ -12,7 +12,8 @@ namespace qt | ||||||
| namespace map | namespace map | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::map::color_table_layer] "; | static const std::string logPrefix_ = "scwx::qt::map::color_table_layer"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class ColorTableLayerImpl | class ColorTableLayerImpl | ||||||
| { | { | ||||||
|  | @ -47,7 +48,7 @@ ColorTableLayer::~ColorTableLayer() = default; | ||||||
| 
 | 
 | ||||||
| void ColorTableLayer::Initialize() | void ColorTableLayer::Initialize() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()"; |    logger_->debug("Initialize()"); | ||||||
| 
 | 
 | ||||||
|    gl::OpenGLFunctions& gl = context()->gl_; |    gl::OpenGLFunctions& gl = context()->gl_; | ||||||
| 
 | 
 | ||||||
|  | @ -58,7 +59,7 @@ void ColorTableLayer::Initialize() | ||||||
|       gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix"); |       gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix"); | ||||||
|    if (p->uMVPMatrixLocation_ == -1) |    if (p->uMVPMatrixLocation_ == -1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find uMVPMatrix"; |       logger_->warn("Could not find uMVPMatrix"); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    gl.glGenTextures(1, &p->texture_); |    gl.glGenTextures(1, &p->texture_); | ||||||
|  | @ -170,7 +171,7 @@ void ColorTableLayer::Render(const QMapbox::CustomLayerRenderParameters& params) | ||||||
| 
 | 
 | ||||||
| void ColorTableLayer::Deinitialize() | void ColorTableLayer::Deinitialize() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Deinitialize()"; |    logger_->debug("Deinitialize()"); | ||||||
| 
 | 
 | ||||||
|    gl::OpenGLFunctions& gl = context()->gl_; |    gl::OpenGLFunctions& gl = context()->gl_; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| #include <scwx/qt/map/draw_layer.hpp> | #include <scwx/qt/map/draw_layer.hpp> | ||||||
| #include <scwx/qt/gl/shader_program.hpp> | #include <scwx/qt/gl/shader_program.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <glm/glm.hpp> | #include <glm/glm.hpp> | ||||||
| #include <glm/gtc/matrix_transform.hpp> | #include <glm/gtc/matrix_transform.hpp> | ||||||
| #include <glm/gtc/type_ptr.hpp> | #include <glm/gtc/type_ptr.hpp> | ||||||
|  | @ -13,7 +13,8 @@ namespace qt | ||||||
| namespace map | namespace map | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::map::draw_layer] "; | static const std::string logPrefix_ = "scwx::qt::map::draw_layer"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class DrawLayerImpl | class DrawLayerImpl | ||||||
| { | { | ||||||
|  | @ -47,7 +48,7 @@ void DrawLayer::Initialize() | ||||||
|       gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix"); |       gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix"); | ||||||
|    if (p->uMVPMatrixLocation_ == -1) |    if (p->uMVPMatrixLocation_ == -1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find uMVPMatrix"; |       logger_->warn("Could not find uMVPMatrix"); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    p->shaderProgram_.Use(); |    p->shaderProgram_.Use(); | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ | ||||||
| #include <scwx/qt/map/radar_product_layer.hpp> | #include <scwx/qt/map/radar_product_layer.hpp> | ||||||
| #include <scwx/qt/map/radar_range_layer.hpp> | #include <scwx/qt/map/radar_range_layer.hpp> | ||||||
| #include <scwx/qt/view/radar_product_view_factory.hpp> | #include <scwx/qt/view/radar_product_view_factory.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> | ||||||
| 
 | 
 | ||||||
|  | @ -20,8 +21,6 @@ | ||||||
| #include <QMouseEvent> | #include <QMouseEvent> | ||||||
| #include <QString> | #include <QString> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace qt | namespace qt | ||||||
|  | @ -29,7 +28,8 @@ namespace qt | ||||||
| namespace map | namespace map | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::map::map_widget] "; | static const std::string logPrefix_ = "scwx::qt::map::map_widget"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| typedef std::pair<std::string, std::string> MapStyle; | typedef std::pair<std::string, std::string> MapStyle; | ||||||
| 
 | 
 | ||||||
|  | @ -309,10 +309,11 @@ void MapWidget::SelectRadarProduct( | ||||||
|       productCode = level3File->message()->header().message_code(); |       productCode = level3File->message()->header().message_code(); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("SelectRadarProduct: {}, {}, {}, {}", | ||||||
|       << logPrefix_ << "SelectRadarProduct(" << radarId << ", " |                   radarId, | ||||||
|       << common::GetRadarProductGroupName(group) << ", " << product << ", " |                   common::GetRadarProductGroupName(group), | ||||||
|       << util::TimeString(time) << ")"; |                   product, | ||||||
|  |                   util::TimeString(time)); | ||||||
| 
 | 
 | ||||||
|    if (group == common::RadarProductGroup::Level2) |    if (group == common::RadarProductGroup::Level2) | ||||||
|    { |    { | ||||||
|  | @ -335,8 +336,7 @@ void MapWidget::SelectRadarProduct( | ||||||
| 
 | 
 | ||||||
|       if (radarProductView == nullptr) |       if (radarProductView == nullptr) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) |          logger_->debug("No view created for product"); | ||||||
|             << logPrefix_ << "No view created for product"; |  | ||||||
|          return; |          return; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ | ||||||
| #include <scwx/qt/gl/shader_program.hpp> | #include <scwx/qt/gl/shader_program.hpp> | ||||||
| #include <scwx/qt/gl/text_shader.hpp> | #include <scwx/qt/gl/text_shader.hpp> | ||||||
| #include <scwx/qt/util/font.hpp> | #include <scwx/qt/util/font.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/time.hpp> | #include <scwx/util/time.hpp> | ||||||
| 
 | 
 | ||||||
| #include <chrono> | #include <chrono> | ||||||
|  | @ -10,7 +11,6 @@ | ||||||
| 
 | 
 | ||||||
| #include <boost/date_time.hpp> | #include <boost/date_time.hpp> | ||||||
| #include <boost/date_time/local_time/local_time.hpp> | #include <boost/date_time/local_time/local_time.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
| #include <GeographicLib/Geodesic.hpp> | #include <GeographicLib/Geodesic.hpp> | ||||||
| #include <glm/glm.hpp> | #include <glm/glm.hpp> | ||||||
|  | @ -25,7 +25,8 @@ namespace qt | ||||||
| namespace map | namespace map | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::map::overlay_layer] "; | static const std::string logPrefix_ = "scwx::qt::map::overlay_layer"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class OverlayLayerImpl | class OverlayLayerImpl | ||||||
| { | { | ||||||
|  | @ -74,7 +75,7 @@ OverlayLayer::~OverlayLayer() = default; | ||||||
| 
 | 
 | ||||||
| void OverlayLayer::Initialize() | void OverlayLayer::Initialize() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()"; |    logger_->debug("Initialize()"); | ||||||
| 
 | 
 | ||||||
|    DrawLayer::Initialize(); |    DrawLayer::Initialize(); | ||||||
| 
 | 
 | ||||||
|  | @ -154,7 +155,7 @@ void OverlayLayer::Render(const QMapbox::CustomLayerRenderParameters& params) | ||||||
| 
 | 
 | ||||||
| void OverlayLayer::Deinitialize() | void OverlayLayer::Deinitialize() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Deinitialize()"; |    logger_->debug("Deinitialize()"); | ||||||
| 
 | 
 | ||||||
|    DrawLayer::Deinitialize(); |    DrawLayer::Deinitialize(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,9 +1,9 @@ | ||||||
| #include <scwx/qt/map/radar_product_layer.hpp> | #include <scwx/qt/map/radar_product_layer.hpp> | ||||||
| #include <scwx/qt/gl/shader_program.hpp> | #include <scwx/qt/gl/shader_program.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <execution> | #include <execution> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <boost/timer/timer.hpp> | #include <boost/timer/timer.hpp> | ||||||
| #include <GeographicLib/Geodesic.hpp> | #include <GeographicLib/Geodesic.hpp> | ||||||
| #include <glm/glm.hpp> | #include <glm/glm.hpp> | ||||||
|  | @ -21,7 +21,8 @@ namespace map | ||||||
| static constexpr uint32_t MAX_RADIALS           = 720; | static constexpr uint32_t MAX_RADIALS           = 720; | ||||||
| static constexpr uint32_t MAX_DATA_MOMENT_GATES = 1840; | static constexpr uint32_t MAX_DATA_MOMENT_GATES = 1840; | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::map::radar_product_layer] "; | static const std::string logPrefix_ = "scwx::qt::map::radar_product_layer"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static glm::vec2 | static glm::vec2 | ||||||
| LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate); | LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate); | ||||||
|  | @ -73,7 +74,7 @@ RadarProductLayer::~RadarProductLayer() = default; | ||||||
| 
 | 
 | ||||||
| void RadarProductLayer::Initialize() | void RadarProductLayer::Initialize() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()"; |    logger_->debug("Initialize()"); | ||||||
| 
 | 
 | ||||||
|    gl::OpenGLFunctions& gl = context()->gl_; |    gl::OpenGLFunctions& gl = context()->gl_; | ||||||
| 
 | 
 | ||||||
|  | @ -84,38 +85,35 @@ void RadarProductLayer::Initialize() | ||||||
|       gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix"); |       gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix"); | ||||||
|    if (p->uMVPMatrixLocation_ == -1) |    if (p->uMVPMatrixLocation_ == -1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find uMVPMatrix"; |       logger_->warn("Could not find uMVPMatrix"); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    p->uMapScreenCoordLocation_ = |    p->uMapScreenCoordLocation_ = | ||||||
|       gl.glGetUniformLocation(p->shaderProgram_.id(), "uMapScreenCoord"); |       gl.glGetUniformLocation(p->shaderProgram_.id(), "uMapScreenCoord"); | ||||||
|    if (p->uMapScreenCoordLocation_ == -1) |    if (p->uMapScreenCoordLocation_ == -1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not find uMapScreenCoord"); | ||||||
|          << logPrefix_ << "Could not find uMapScreenCoord"; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    p->uDataMomentOffsetLocation_ = |    p->uDataMomentOffsetLocation_ = | ||||||
|       gl.glGetUniformLocation(p->shaderProgram_.id(), "uDataMomentOffset"); |       gl.glGetUniformLocation(p->shaderProgram_.id(), "uDataMomentOffset"); | ||||||
|    if (p->uDataMomentOffsetLocation_ == -1) |    if (p->uDataMomentOffsetLocation_ == -1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not find uDataMomentOffset"); | ||||||
|          << logPrefix_ << "Could not find uDataMomentOffset"; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    p->uDataMomentScaleLocation_ = |    p->uDataMomentScaleLocation_ = | ||||||
|       gl.glGetUniformLocation(p->shaderProgram_.id(), "uDataMomentScale"); |       gl.glGetUniformLocation(p->shaderProgram_.id(), "uDataMomentScale"); | ||||||
|    if (p->uDataMomentScaleLocation_ == -1) |    if (p->uDataMomentScaleLocation_ == -1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not find uDataMomentScale"); | ||||||
|          << logPrefix_ << "Could not find uDataMomentScale"; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    p->uCFPEnabledLocation_ = |    p->uCFPEnabledLocation_ = | ||||||
|       gl.glGetUniformLocation(p->shaderProgram_.id(), "uCFPEnabled"); |       gl.glGetUniformLocation(p->shaderProgram_.id(), "uCFPEnabled"); | ||||||
|    if (p->uCFPEnabledLocation_ == -1) |    if (p->uCFPEnabledLocation_ == -1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find uCFPEnabled"; |       logger_->warn("Could not find uCFPEnabled"); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    p->shaderProgram_.Use(); |    p->shaderProgram_.Use(); | ||||||
|  | @ -148,7 +146,7 @@ void RadarProductLayer::Initialize() | ||||||
| 
 | 
 | ||||||
| void RadarProductLayer::UpdateSweep() | void RadarProductLayer::UpdateSweep() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateSweep()"; |    logger_->debug("UpdateSweep()"); | ||||||
| 
 | 
 | ||||||
|    gl::OpenGLFunctions& gl = context()->gl_; |    gl::OpenGLFunctions& gl = context()->gl_; | ||||||
| 
 | 
 | ||||||
|  | @ -161,8 +159,7 @@ void RadarProductLayer::UpdateSweep() | ||||||
|                               std::try_to_lock); |                               std::try_to_lock); | ||||||
|    if (!sweepLock.owns_lock()) |    if (!sweepLock.owns_lock()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Sweep locked, deferring update"); | ||||||
|          << logPrefix_ << "Sweep locked, deferring update"; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -181,8 +178,7 @@ void RadarProductLayer::UpdateSweep() | ||||||
|                    vertices.data(), |                    vertices.data(), | ||||||
|                    GL_STATIC_DRAW); |                    GL_STATIC_DRAW); | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Vertices buffered in {}", timer.format(6, "%ws")); | ||||||
|       << logPrefix_ << "Vertices buffered in " << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    gl.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0)); |    gl.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0)); | ||||||
|    gl.glEnableVertexAttribArray(0); |    gl.glEnableVertexAttribArray(0); | ||||||
|  | @ -208,8 +204,7 @@ void RadarProductLayer::UpdateSweep() | ||||||
|    timer.start(); |    timer.start(); | ||||||
|    gl.glBufferData(GL_ARRAY_BUFFER, dataSize, data, GL_STATIC_DRAW); |    gl.glBufferData(GL_ARRAY_BUFFER, dataSize, data, GL_STATIC_DRAW); | ||||||
|    timer.stop(); |    timer.stop(); | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Data moments buffered in {}", timer.format(6, "%ws")); | ||||||
|       << logPrefix_ << "Data moments buffered in " << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|    gl.glVertexAttribIPointer(1, 1, type, 0, static_cast<void*>(0)); |    gl.glVertexAttribIPointer(1, 1, type, 0, static_cast<void*>(0)); | ||||||
|    gl.glEnableVertexAttribArray(1); |    gl.glEnableVertexAttribArray(1); | ||||||
|  | @ -238,8 +233,7 @@ void RadarProductLayer::UpdateSweep() | ||||||
|       timer.start(); |       timer.start(); | ||||||
|       gl.glBufferData(GL_ARRAY_BUFFER, cfpDataSize, cfpData, GL_STATIC_DRAW); |       gl.glBufferData(GL_ARRAY_BUFFER, cfpDataSize, cfpData, GL_STATIC_DRAW); | ||||||
|       timer.stop(); |       timer.stop(); | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("CFP moments buffered in {}", timer.format(6, "%ws")); | ||||||
|          << logPrefix_ << "CFP moments buffered in " << timer.format(6, "%ws"); |  | ||||||
| 
 | 
 | ||||||
|       gl.glVertexAttribIPointer(2, 1, cfpType, 0, static_cast<void*>(0)); |       gl.glVertexAttribIPointer(2, 1, cfpType, 0, static_cast<void*>(0)); | ||||||
|       gl.glEnableVertexAttribArray(2); |       gl.glEnableVertexAttribArray(2); | ||||||
|  | @ -294,11 +288,13 @@ void RadarProductLayer::Render( | ||||||
|    gl.glBindTexture(GL_TEXTURE_1D, p->texture_); |    gl.glBindTexture(GL_TEXTURE_1D, p->texture_); | ||||||
|    gl.glBindVertexArray(p->vao_); |    gl.glBindVertexArray(p->vao_); | ||||||
|    gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_); |    gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_); | ||||||
|  | 
 | ||||||
|  |    SCWX_GL_CHECK_ERROR(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void RadarProductLayer::Deinitialize() | void RadarProductLayer::Deinitialize() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Deinitialize()"; |    logger_->debug("Deinitialize()"); | ||||||
| 
 | 
 | ||||||
|    gl::OpenGLFunctions& gl = context()->gl_; |    gl::OpenGLFunctions& gl = context()->gl_; | ||||||
| 
 | 
 | ||||||
|  | @ -317,7 +313,7 @@ void RadarProductLayer::Deinitialize() | ||||||
| 
 | 
 | ||||||
| void RadarProductLayer::UpdateColorTable() | void RadarProductLayer::UpdateColorTable() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateColorTable()"; |    logger_->debug("UpdateColorTable()"); | ||||||
| 
 | 
 | ||||||
|    p->colorTableNeedsUpdate_ = false; |    p->colorTableNeedsUpdate_ = false; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| #include <scwx/qt/map/radar_range_layer.hpp> | #include <scwx/qt/map/radar_range_layer.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| #include <GeographicLib/Geodesic.hpp> | #include <GeographicLib/Geodesic.hpp> | ||||||
| #include <glm/glm.hpp> | #include <glm/glm.hpp> | ||||||
| 
 | 
 | ||||||
|  | @ -11,7 +11,8 @@ namespace qt | ||||||
| namespace map | namespace map | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::qt::map::radar_range_layer] "; | static const std::string logPrefix_ = "scwx::qt::map::radar_range_layer"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static std::shared_ptr<QMapbox::Feature> | static std::shared_ptr<QMapbox::Feature> | ||||||
| GetRangeCircle(float range, QMapbox::Coordinate center); | GetRangeCircle(float range, QMapbox::Coordinate center); | ||||||
|  | @ -21,7 +22,7 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapboxGL> map, | ||||||
|                           QMapbox::Coordinate        center, |                           QMapbox::Coordinate        center, | ||||||
|                           const QString&             before) |                           const QString&             before) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Add()"; |    logger_->debug("Add()"); | ||||||
| 
 | 
 | ||||||
|    if (map->layerExists("rangeCircleLayer")) |    if (map->layerExists("rangeCircleLayer")) | ||||||
|    { |    { | ||||||
|  |  | ||||||
|  | @ -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; | ||||||
|  |  | ||||||
|  | @ -102,7 +102,7 @@ | ||||||
| <context> | <context> | ||||||
|     <name>scwx::qt::main::MainWindow</name> |     <name>scwx::qt::main::MainWindow</name> | ||||||
|     <message> |     <message> | ||||||
|         <location filename="../source/scwx/qt/main/main_window.cpp" line="279"/> |         <location filename="../source/scwx/qt/main/main_window.cpp" line="278"/> | ||||||
|         <source>Unrecognized NEXRAD Product:</source> |         <source>Unrecognized NEXRAD Product:</source> | ||||||
|         <translation type="unfinished"></translation> |         <translation type="unfinished"></translation> | ||||||
|     </message> |     </message> | ||||||
|  |  | ||||||
|  | @ -2,14 +2,12 @@ | ||||||
| 
 | 
 | ||||||
| #include <gtest/gtest.h> | #include <gtest/gtest.h> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::coded_location.test] "; | static const std::string logPrefix_ = "scwx::awips::coded_location.test"; | ||||||
| 
 | 
 | ||||||
| TEST(CodedLocation, WFO100W) | TEST(CodedLocation, WFO100W) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -2,15 +2,13 @@ | ||||||
| 
 | 
 | ||||||
| #include <gtest/gtest.h> | #include <gtest/gtest.h> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::awips::coded_time_motion_location.test] "; |    "scwx::awips::coded_time_motion_location.test"; | ||||||
| 
 | 
 | ||||||
| TEST(CodedTimeMotionLocation, LeadingZeroes) | TEST(CodedTimeMotionLocation, LeadingZeroes) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -2,14 +2,12 @@ | ||||||
| 
 | 
 | ||||||
| #include <gtest/gtest.h> | #include <gtest/gtest.h> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::pvtec.test] "; | static const std::string logPrefix_ = "scwx::awips::pvtec.test"; | ||||||
| 
 | 
 | ||||||
| std::pair<std::chrono::year_month_day, | std::pair<std::chrono::year_month_day, | ||||||
|           std::chrono::hh_mm_ss<std::chrono::minutes>> |           std::chrono::hh_mm_ss<std::chrono::minutes>> | ||||||
|  |  | ||||||
|  | @ -2,14 +2,12 @@ | ||||||
| 
 | 
 | ||||||
| #include <gtest/gtest.h> | #include <gtest/gtest.h> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::text_product_file.test] "; | static const std::string logPrefix_ = "scwx::awips::text_product_file.test"; | ||||||
| 
 | 
 | ||||||
| class TextProductValidFileTest : public testing::TestWithParam<std::string> | class TextProductValidFileTest : public testing::TestWithParam<std::string> | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -4,15 +4,12 @@ | ||||||
| 
 | 
 | ||||||
| #include <gtest/gtest.h> | #include <gtest/gtest.h> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::nexrad_file_factory.test"; | ||||||
|    "[scwx::wsr88d::nexrad_file_factory.test] "; |  | ||||||
| 
 | 
 | ||||||
| TEST(NexradFileFactory, Level2V06) | TEST(NexradFileFactory, Level2V06) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -1,12 +1,12 @@ | ||||||
| #include <gtest/gtest.h> | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/expressions.hpp> | #include <gtest/gtest.h> | ||||||
| #include <boost/log/trivial.hpp> | #include <spdlog/spdlog.h> | ||||||
| 
 | 
 | ||||||
| int main(int argc, char** argv) | int main(int argc, char** argv) | ||||||
| { | { | ||||||
|    boost::log::core::get()->set_filter(boost::log::trivial::severity >= |    scwx::util::Logger::Initialize(); | ||||||
|                                        boost::log::trivial::debug); |    spdlog::set_level(spdlog::level::debug); | ||||||
| 
 | 
 | ||||||
|    ::testing::InitGoogleTest(&argc, argv); |    ::testing::InitGoogleTest(&argc, argv); | ||||||
|    return RUN_ALL_TESTS(); |    return RUN_ALL_TESTS(); | ||||||
|  |  | ||||||
|  | @ -54,11 +54,6 @@ endif() | ||||||
| 
 | 
 | ||||||
| target_compile_definitions(wxtest PRIVATE SCWX_TEST_DATA_DIR="${SCWX_DIR}/test/data") | target_compile_definitions(wxtest PRIVATE SCWX_TEST_DATA_DIR="${SCWX_DIR}/test/data") | ||||||
| 
 | 
 | ||||||
| if (WIN32) |  | ||||||
|     # For Boost::log |  | ||||||
|     target_compile_definitions(wxtest PRIVATE BOOST_USE_WINAPI_VERSION=0x0601) |  | ||||||
| endif() |  | ||||||
| 
 |  | ||||||
| gtest_discover_tests(wxtest) | gtest_discover_tests(wxtest) | ||||||
| 
 | 
 | ||||||
| target_link_libraries(wxtest GTest::gtest | target_link_libraries(wxtest GTest::gtest | ||||||
|  |  | ||||||
							
								
								
									
										20
									
								
								wxdata/include/scwx/util/logger.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								wxdata/include/scwx/util/logger.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <memory> | ||||||
|  | #include <string> | ||||||
|  | 
 | ||||||
|  | #include <spdlog/logger.h> | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace util | ||||||
|  | { | ||||||
|  | namespace Logger | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | void                            Initialize(); | ||||||
|  | std::shared_ptr<spdlog::logger> Create(const std::string& name); | ||||||
|  | 
 | ||||||
|  | } // namespace Logger
 | ||||||
|  | } // namespace util
 | ||||||
|  | } // namespace scwx
 | ||||||
|  | @ -1,15 +1,15 @@ | ||||||
| #include <scwx/awips/coded_location.hpp> | #include <scwx/awips/coded_location.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <sstream> | #include <sstream> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::coded_location] "; | static const std::string logPrefix_ = "scwx::awips::coded_location"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class CodedLocationImpl | class CodedLocationImpl | ||||||
| { | { | ||||||
|  | @ -93,9 +93,8 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo) | ||||||
|             } |             } | ||||||
|             catch (const std::exception& ex) |             catch (const std::exception& ex) | ||||||
|             { |             { | ||||||
|                BOOST_LOG_TRIVIAL(warning) |                logger_->warn( | ||||||
|                   << logPrefix_ << "Invalid WFO location token: \"" << *token |                   "Invalid WFO location token: \"{}\" ({})", *token, ex.what()); | ||||||
|                   << "\" (" << ex.what() << ")"; |  | ||||||
|                dataValid = false; |                dataValid = false; | ||||||
|                break; |                break; | ||||||
|             } |             } | ||||||
|  | @ -128,10 +127,8 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo) | ||||||
|          { |          { | ||||||
|             if (token->size() != 8) |             if (token->size() != 8) | ||||||
|             { |             { | ||||||
|                BOOST_LOG_TRIVIAL(warning) |                logger_->warn("Invalid National Center LAT...LON format: \"{}\"", | ||||||
|                   << logPrefix_ |                              *token); | ||||||
|                   << "Invalid National Center LAT...LON format: \"" << *token |  | ||||||
|                   << "\""; |  | ||||||
| 
 | 
 | ||||||
|                dataValid = false; |                dataValid = false; | ||||||
|                break; |                break; | ||||||
|  | @ -147,9 +144,10 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo) | ||||||
|             } |             } | ||||||
|             catch (const std::exception& ex) |             catch (const std::exception& ex) | ||||||
|             { |             { | ||||||
|                BOOST_LOG_TRIVIAL(warning) |                logger_->warn( | ||||||
|                   << logPrefix_ << "Invalid National Center location token: \"" |                   "Invalid National Center location token: \"{}\" ({})", | ||||||
|                   << *token << "\" (" << ex.what() << ")"; |                   *token, | ||||||
|  |                   ex.what()); | ||||||
|                dataValid = false; |                dataValid = false; | ||||||
|                break; |                break; | ||||||
|             } |             } | ||||||
|  | @ -174,18 +172,17 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo) | ||||||
|    { |    { | ||||||
|       if (tokenList.empty()) |       if (tokenList.empty()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "LAT...LON not found"; |          logger_->warn("LAT...LON not found"); | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Malformed LAT...LON tokens: (0: {}, size: {})", | ||||||
|             << logPrefix_ |                        tokenList.at(0), | ||||||
|             << "Malformed LAT...LON tokens: (0: " << tokenList.at(0) |                        tokenList.size()); | ||||||
|             << ", size: " << tokenList.size() << ")"; |  | ||||||
| 
 | 
 | ||||||
|          for (const auto& token : tokenList) |          for (const auto& token : tokenList) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(debug) << logPrefix_ << token; |             logger_->debug("{}", token); | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,18 +4,17 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include <scwx/awips/coded_time_motion_location.hpp> | #include <scwx/awips/coded_time_motion_location.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <sstream> | #include <sstream> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::awips::coded_time_motion_location"; | ||||||
|    "[scwx::awips::coded_time_motion_location] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class CodedTimeMotionLocationImpl | class CodedTimeMotionLocationImpl | ||||||
| { | { | ||||||
|  | @ -111,8 +110,7 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines, | ||||||
|          } |          } | ||||||
|          else |          else | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid time: \"{}\"", time); | ||||||
|                << logPrefix_ << "Invalid time: \"" << time << "\""; |  | ||||||
|             p->time_  = hh_mm_ss<minutes> {}; |             p->time_  = hh_mm_ss<minutes> {}; | ||||||
|             dataValid = false; |             dataValid = false; | ||||||
|          } |          } | ||||||
|  | @ -129,16 +127,14 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines, | ||||||
|          } |          } | ||||||
|          catch (const std::exception& ex) |          catch (const std::exception& ex) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn( | ||||||
|                << logPrefix_ << "Invalid direction: \"" << direction << "\" (" |                "Invalid direction: \"{}\" ({})", direction, ex.what()); | ||||||
|                << ex.what() << ")"; |  | ||||||
|             dataValid = false; |             dataValid = false; | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid direction: \"{}\"", direction); | ||||||
|             << logPrefix_ << "Invalid direction: \"" << direction << "\""; |  | ||||||
|          dataValid = false; |          dataValid = false; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  | @ -153,15 +149,13 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines, | ||||||
|          } |          } | ||||||
|          catch (const std::exception& ex) |          catch (const std::exception& ex) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Invalid speed: \"" |             logger_->warn("Invalid speed: \"{}\" ({})", speed, ex.what()); | ||||||
|                                        << speed << "\" (" << ex.what() << ")"; |  | ||||||
|             dataValid = false; |             dataValid = false; | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid speed: \"{}\"", speed); | ||||||
|             << logPrefix_ << "Invalid speed: \"" << speed << "\""; |  | ||||||
|          dataValid = false; |          dataValid = false; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  | @ -180,9 +174,8 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines, | ||||||
|          } |          } | ||||||
|          catch (const std::exception& ex) |          catch (const std::exception& ex) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn( | ||||||
|                << logPrefix_ << "Invalid location token: \"" << *token << "\" (" |                "Invalid location token: \"{}\" ({})", *token, ex.what()); | ||||||
|                << ex.what() << ")"; |  | ||||||
|             dataValid = false; |             dataValid = false; | ||||||
|             break; |             break; | ||||||
|          } |          } | ||||||
|  | @ -212,19 +205,17 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines, | ||||||
|    { |    { | ||||||
|       if (tokenList.empty()) |       if (tokenList.empty()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("TIME...MOT...LOC not found"); | ||||||
|             << logPrefix_ << "TIME...MOT...LOC not found"; |  | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Malformed TIME...MOT...LOC tokens: (0: {}, size: {})", | ||||||
|             << logPrefix_ |                        tokenList.at(0), | ||||||
|             << "Malformed TIME...MOT...LOC tokens: (0: " << tokenList.at(0) |                        tokenList.size()); | ||||||
|             << ", size: " << tokenList.size() << ")"; |  | ||||||
| 
 | 
 | ||||||
|          for (const auto& token : tokenList) |          for (const auto& token : tokenList) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(debug) << logPrefix_ << token; |             logger_->debug("{}", token); | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,13 +1,13 @@ | ||||||
| #include <scwx/awips/message.hpp> | #include <scwx/awips/message.hpp> | ||||||
| 
 | #include <scwx/util/logger.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::message] "; | static const std::string logPrefix_ = "scwx::awips::message"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class MessageImpl | class MessageImpl | ||||||
| { | { | ||||||
|  | @ -30,13 +30,12 @@ bool Message::ValidateMessage(std::istream& is, size_t bytesRead) const | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Reached end of data stream"; |       logger_->warn("Reached end of data stream"); | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    else if (is.fail()) |    else if (is.fail()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not read from input stream"); | ||||||
|          << logPrefix_ << "Could not read from input stream"; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    else if (bytesRead != dataSize) |    else if (bytesRead != dataSize) | ||||||
|  | @ -47,15 +46,15 @@ bool Message::ValidateMessage(std::istream& is, size_t bytesRead) const | ||||||
| 
 | 
 | ||||||
|       if (bytesRead < dataSize) |       if (bytesRead < dataSize) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(trace) |          logger_->trace("Message contents smaller than size: {} < {} bytes", | ||||||
|             << logPrefix_ << "Message contents smaller than size: " << bytesRead |                         bytesRead, | ||||||
|             << " < " << dataSize << " bytes"; |                         dataSize); | ||||||
|       } |       } | ||||||
|       if (bytesRead > dataSize) |       if (bytesRead > dataSize) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Message contents larger than size: {} > {} bytes", | ||||||
|             << logPrefix_ << "Message contents larger than size: " << bytesRead |                        bytesRead, | ||||||
|             << " > " << dataSize << " bytes"; |                        dataSize); | ||||||
|          messageValid = false; |          messageValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,16 +1,17 @@ | ||||||
| #include <scwx/awips/phenomenon.hpp> | #include <scwx/awips/phenomenon.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/assign.hpp> | #include <boost/assign.hpp> | ||||||
| #include <boost/bimap.hpp> | #include <boost/bimap.hpp> | ||||||
| #include <boost/bimap/unordered_set_of.hpp> | #include <boost/bimap/unordered_set_of.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::phenomenon] "; | static const std::string logPrefix_ = "scwx::awips::phenomenon"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| typedef boost::bimap<boost::bimaps::unordered_set_of<Phenomenon>, | typedef boost::bimap<boost::bimaps::unordered_set_of<Phenomenon>, | ||||||
|                      boost::bimaps::unordered_set_of<std::string>> |                      boost::bimaps::unordered_set_of<std::string>> | ||||||
|  | @ -147,8 +148,7 @@ Phenomenon GetPhenomenon(const std::string& code) | ||||||
|    { |    { | ||||||
|       phenomenon = Phenomenon::Unknown; |       phenomenon = Phenomenon::Unknown; | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Unrecognized code: \"{}\"", code); | ||||||
|          << logPrefix_ << "Unrecognized code: \"" << code << "\""; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return phenomenon; |    return phenomenon; | ||||||
|  |  | ||||||
|  | @ -4,20 +4,21 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include <scwx/awips/pvtec.hpp> | #include <scwx/awips/pvtec.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <chrono> | #include <chrono> | ||||||
| 
 | 
 | ||||||
| #include <boost/assign.hpp> | #include <boost/assign.hpp> | ||||||
| #include <boost/bimap.hpp> | #include <boost/bimap.hpp> | ||||||
| #include <boost/bimap/unordered_set_of.hpp> | #include <boost/bimap/unordered_set_of.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::pvtec] "; | static const std::string logPrefix_ = "scwx::awips::pvtec"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| typedef boost::bimap<boost::bimaps::unordered_set_of<PVtec::ProductType>, | typedef boost::bimap<boost::bimaps::unordered_set_of<PVtec::ProductType>, | ||||||
|                      boost::bimaps::unordered_set_of<std::string>> |                      boost::bimaps::unordered_set_of<std::string>> | ||||||
|  | @ -171,9 +172,9 @@ bool PVtec::Parse(const std::string& s) | ||||||
|       } |       } | ||||||
|       catch (const std::exception& ex) |       catch (const std::exception& ex) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Error parsing event tracking number: \"{}\" ({})", | ||||||
|             << logPrefix_ << "Error parsing event tracking number: \"" |                        eventNumberString, | ||||||
|             << eventNumberString << "\" (" << ex.what() << ")"; |                        ex.what()); | ||||||
| 
 | 
 | ||||||
|          p->eventTrackingNumber_ = -1; |          p->eventTrackingNumber_ = -1; | ||||||
|       } |       } | ||||||
|  | @ -214,8 +215,7 @@ bool PVtec::Parse(const std::string& s) | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid P-VTEC: \"{}\"", s); | ||||||
|          << logPrefix_ << "Invalid P-VTEC: \"" << s << "\""; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    p->valid_ = dataValid; |    p->valid_ = dataValid; | ||||||
|  | @ -235,8 +235,7 @@ PVtec::ProductType PVtec::GetProductType(const std::string& code) | ||||||
|    { |    { | ||||||
|       productType = ProductType::Unknown; |       productType = ProductType::Unknown; | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Unrecognized product code: \"{}\"", code); | ||||||
|          << logPrefix_ << "Unrecognized product code: \"" << code << "\""; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return productType; |    return productType; | ||||||
|  | @ -259,8 +258,7 @@ PVtec::Action PVtec::GetAction(const std::string& code) | ||||||
|    { |    { | ||||||
|       action = Action::Unknown; |       action = Action::Unknown; | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Unrecognized action code: \"{}\"", code); | ||||||
|          << logPrefix_ << "Unrecognized action code: \"" << code << "\""; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return action; |    return action; | ||||||
|  |  | ||||||
|  | @ -1,16 +1,17 @@ | ||||||
| #include <scwx/awips/significance.hpp> | #include <scwx/awips/significance.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/assign.hpp> | #include <boost/assign.hpp> | ||||||
| #include <boost/bimap.hpp> | #include <boost/bimap.hpp> | ||||||
| #include <boost/bimap/unordered_set_of.hpp> | #include <boost/bimap/unordered_set_of.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::significance] "; | static const std::string logPrefix_ = "scwx::awips::significance"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| typedef boost::bimap<boost::bimaps::unordered_set_of<Significance>, | typedef boost::bimap<boost::bimaps::unordered_set_of<Significance>, | ||||||
|                      boost::bimaps::unordered_set_of<std::string>> |                      boost::bimaps::unordered_set_of<std::string>> | ||||||
|  | @ -49,8 +50,7 @@ Significance GetSignificance(const std::string& code) | ||||||
|    { |    { | ||||||
|       significance = Significance::Unknown; |       significance = Significance::Unknown; | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Unrecognized code: \"{}\"", code); | ||||||
|          << logPrefix_ << "Unrecognized code: \"" << code << "\""; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return significance; |    return significance; | ||||||
|  |  | ||||||
|  | @ -1,15 +1,15 @@ | ||||||
| #include <scwx/awips/text_product_file.hpp> | #include <scwx/awips/text_product_file.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <fstream> | #include <fstream> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::text_product_file] "; | static const std::string logPrefix_ = "scwx::awips::text_product_file"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class TextProductFileImpl | class TextProductFileImpl | ||||||
| { | { | ||||||
|  | @ -41,14 +41,13 @@ std::shared_ptr<TextProductMessage> TextProductFile::message(size_t i) const | ||||||
| 
 | 
 | ||||||
| bool TextProductFile::LoadFile(const std::string& filename) | bool TextProductFile::LoadFile(const std::string& filename) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")"; |    logger_->debug("LoadFile: {}", filename); | ||||||
|    bool fileValid = true; |    bool fileValid = true; | ||||||
| 
 | 
 | ||||||
|    std::ifstream f(filename, std::ios_base::in | std::ios_base::binary); |    std::ifstream f(filename, std::ios_base::in | std::ios_base::binary); | ||||||
|    if (!f.good()) |    if (!f.good()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not open file for reading: {}", filename); | ||||||
|          << logPrefix_ << "Could not open file for reading: " << filename; |  | ||||||
|       fileValid = false; |       fileValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -62,7 +61,7 @@ bool TextProductFile::LoadFile(const std::string& filename) | ||||||
| 
 | 
 | ||||||
| bool TextProductFile::LoadData(std::istream& is) | bool TextProductFile::LoadData(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Data"; |    logger_->debug("Loading Data"); | ||||||
| 
 | 
 | ||||||
|    while (!is.eof()) |    while (!is.eof()) | ||||||
|    { |    { | ||||||
|  |  | ||||||
|  | @ -9,14 +9,12 @@ | ||||||
| #include <regex> | #include <regex> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::text_product_message] "; | static const std::string logPrefix_ = "scwx::awips::text_product_message"; | ||||||
| 
 | 
 | ||||||
| // Issuance date/time takes one of the following forms:
 | // Issuance date/time takes one of the following forms:
 | ||||||
| // * <hhmm>_xM_<tz>_day_mon_<dd>_year
 | // * <hhmm>_xM_<tz>_day_mon_<dd>_year
 | ||||||
|  |  | ||||||
|  | @ -1,12 +1,11 @@ | ||||||
| #include <scwx/awips/wmo_header.hpp> | #include <scwx/awips/wmo_header.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/streams.hpp> | #include <scwx/util/streams.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <sstream> | #include <sstream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| #ifdef WIN32 | #ifdef WIN32 | ||||||
| #   include <WinSock2.h> | #   include <WinSock2.h> | ||||||
| #else | #else | ||||||
|  | @ -18,7 +17,8 @@ namespace scwx | ||||||
| namespace awips | namespace awips | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::awips::wmo_header] "; | static const std::string logPrefix_ = "scwx::awips::wmo_header"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class WmoHeaderImpl | class WmoHeaderImpl | ||||||
| { | { | ||||||
|  | @ -139,7 +139,7 @@ bool WmoHeader::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       headerValid = false; |       headerValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|  | @ -176,29 +176,28 @@ bool WmoHeader::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|       if (wmoTokenList.size() < 3 || wmoTokenList.size() > 4) |       if (wmoTokenList.size() < 3 || wmoTokenList.size() > 4) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) |          logger_->debug("Invalid number of WMO tokens"); | ||||||
|             << logPrefix_ << "Invalid number of WMO tokens"; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       else if (wmoTokenList[0].size() != 6) |       else if (wmoTokenList[0].size() != 6) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "WMO identifier malformed"; |          logger_->debug("WMO identifier malformed"); | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       else if (wmoTokenList[1].size() != 4) |       else if (wmoTokenList[1].size() != 4) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ICAO malformed"; |          logger_->debug("ICAO malformed"); | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       else if (wmoTokenList[2].size() != 6) |       else if (wmoTokenList[2].size() != 6) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Date/time malformed"; |          logger_->debug("Date/time malformed"); | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       else if (wmoTokenList.size() == 4 && wmoTokenList[3].size() != 3) |       else if (wmoTokenList.size() == 4 && wmoTokenList[3].size() != 3) | ||||||
|       { |       { | ||||||
|          // BBB indicator is optional
 |          // BBB indicator is optional
 | ||||||
|          BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "BBB indicator malformed"; |          logger_->debug("BBB indicator malformed"); | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|  | @ -227,8 +226,7 @@ bool WmoHeader::Parse(std::istream& is) | ||||||
|    { |    { | ||||||
|       if (awipsLine.size() != 6) |       if (awipsLine.size() != 6) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) |          logger_->debug("AWIPS Identifier Line bad size"); | ||||||
|             << logPrefix_ << "AWIPS Identifier Line bad size"; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| #include <scwx/common/color_table.hpp> | #include <scwx/common/color_table.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/streams.hpp> | #include <scwx/util/streams.hpp> | ||||||
| 
 | 
 | ||||||
| #include <cmath> | #include <cmath> | ||||||
|  | @ -9,7 +10,6 @@ | ||||||
| #include <sstream> | #include <sstream> | ||||||
| 
 | 
 | ||||||
| #include <boost/gil.hpp> | #include <boost/gil.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| #include <hsluv.h> | #include <hsluv.h> | ||||||
| 
 | 
 | ||||||
|  | @ -18,7 +18,8 @@ namespace scwx | ||||||
| namespace common | namespace common | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ {"[scwx::common::color_table] "}; | static const std::string logPrefix_ {"scwx::common::color_table"}; | ||||||
|  | static const auto        logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| enum class ColorMode | enum class ColorMode | ||||||
| { | { | ||||||
|  | @ -135,8 +136,7 @@ bool ColorTable::IsValid() const | ||||||
| 
 | 
 | ||||||
| std::shared_ptr<ColorTable> ColorTable::Load(const std::string& filename) | std::shared_ptr<ColorTable> ColorTable::Load(const std::string& filename) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Loading color table: {}", filename); | ||||||
|       << logPrefix_ << "Loading color table: " << filename; |  | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<ColorTable> p = std::make_shared<ColorTable>(); |    std::shared_ptr<ColorTable> p = std::make_shared<ColorTable>(); | ||||||
| 
 | 
 | ||||||
|  | @ -167,8 +167,7 @@ std::shared_ptr<ColorTable> ColorTable::Load(const std::string& filename) | ||||||
|          } |          } | ||||||
|          catch (const std::exception&) |          catch (const std::exception&) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Could not parse line: {}", line); | ||||||
|                << logPrefix_ << "Could not parse line: " << line; |  | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
							
								
								
									
										37
									
								
								wxdata/source/scwx/util/logger.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								wxdata/source/scwx/util/logger.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
|  | 
 | ||||||
|  | #include <mutex> | ||||||
|  | 
 | ||||||
|  | #include <spdlog/spdlog.h> | ||||||
|  | #include <spdlog/sinks/stdout_color_sinks.h> | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace util | ||||||
|  | { | ||||||
|  | namespace Logger | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | void Initialize() | ||||||
|  | { | ||||||
|  |    spdlog::set_pattern("[%Y-%m-%d %T.%e] [%t] [%^%l%$] [%n] %v"); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | std::shared_ptr<spdlog::logger> Create(const std::string& name) | ||||||
|  | { | ||||||
|  |    // Create a shared sink
 | ||||||
|  |    static auto sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>(); | ||||||
|  | 
 | ||||||
|  |    // Create the logger
 | ||||||
|  |    std::shared_ptr<spdlog::logger> logger = | ||||||
|  |       std::make_shared<spdlog::logger>(name, sink); | ||||||
|  | 
 | ||||||
|  |    // Register the logger, so it can be retrieved later using spdlog::get()
 | ||||||
|  |    spdlog::register_logger(logger); | ||||||
|  | 
 | ||||||
|  |    return logger; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | } // namespace Logger
 | ||||||
|  | } // namespace util
 | ||||||
|  | } // namespace scwx
 | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| #include <scwx/wsr88d/ar2v_file.hpp> | #include <scwx/wsr88d/ar2v_file.hpp> | ||||||
| #include <scwx/wsr88d/rda/level2_message_factory.hpp> | #include <scwx/wsr88d/rda/level2_message_factory.hpp> | ||||||
| #include <scwx/wsr88d/rda/types.hpp> | #include <scwx/wsr88d/rda/types.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/rangebuf.hpp> | #include <scwx/util/rangebuf.hpp> | ||||||
| #include <scwx/util/time.hpp> | #include <scwx/util/time.hpp> | ||||||
| 
 | 
 | ||||||
|  | @ -10,14 +11,14 @@ | ||||||
| #include <boost/iostreams/copy.hpp> | #include <boost/iostreams/copy.hpp> | ||||||
| #include <boost/iostreams/filtering_streambuf.hpp> | #include <boost/iostreams/filtering_streambuf.hpp> | ||||||
| #include <boost/iostreams/filter/bzip2.hpp> | #include <boost/iostreams/filter/bzip2.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::ar2v_file] "; | static const std::string logPrefix_ = "scwx::wsr88d::ar2v_file"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class Ar2vFileImpl | class Ar2vFileImpl | ||||||
| { | { | ||||||
|  | @ -115,8 +116,7 @@ Ar2vFile::GetElevationScan(rda::DataBlockType                    dataBlockType, | ||||||
|                            float                                 elevation, |                            float                                 elevation, | ||||||
|                            std::chrono::system_clock::time_point time) const |                            std::chrono::system_clock::time_point time) const | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("GetElevationScan: {} degrees", elevation); | ||||||
|       << logPrefix_ << "GetElevationScan: " << elevation << " degrees"; |  | ||||||
| 
 | 
 | ||||||
|    constexpr float scaleFactor = 8.0f / 0.043945f; |    constexpr float scaleFactor = 8.0f / 0.043945f; | ||||||
| 
 | 
 | ||||||
|  | @ -170,14 +170,13 @@ Ar2vFile::GetElevationScan(rda::DataBlockType                    dataBlockType, | ||||||
| 
 | 
 | ||||||
| bool Ar2vFile::LoadFile(const std::string& filename) | bool Ar2vFile::LoadFile(const std::string& filename) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")"; |    logger_->debug("LoadFile: {}", filename); | ||||||
|    bool fileValid = true; |    bool fileValid = true; | ||||||
| 
 | 
 | ||||||
|    std::ifstream f(filename, std::ios_base::in | std::ios_base::binary); |    std::ifstream f(filename, std::ios_base::in | std::ios_base::binary); | ||||||
|    if (!f.good()) |    if (!f.good()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not open file for reading: {}", filename); | ||||||
|          << logPrefix_ << "Could not open file for reading: " << filename; |  | ||||||
|       fileValid = false; |       fileValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -191,7 +190,7 @@ bool Ar2vFile::LoadFile(const std::string& filename) | ||||||
| 
 | 
 | ||||||
| bool Ar2vFile::LoadData(std::istream& is) | bool Ar2vFile::LoadData(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Data"; |    logger_->debug("Loading Data"); | ||||||
| 
 | 
 | ||||||
|    bool dataValid = true; |    bool dataValid = true; | ||||||
| 
 | 
 | ||||||
|  | @ -211,21 +210,17 @@ bool Ar2vFile::LoadData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not read Volume Header Record"); | ||||||
|          << logPrefix_ << "Could not read Volume Header Record\n"; |  | ||||||
|       dataValid = false; |       dataValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (dataValid) |    if (dataValid) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Filename:  {}", p->tapeFilename_); | ||||||
|          << logPrefix_ << "Filename:  " << p->tapeFilename_; |       logger_->debug("Extension: {}", p->extensionNumber_); | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Date:      {}", p->julianDate_); | ||||||
|          << logPrefix_ << "Extension: " << p->extensionNumber_; |       logger_->debug("Time:      {}", p->milliseconds_); | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Date:      " << p->julianDate_; |       logger_->debug("ICAO:      {}", p->icao_); | ||||||
|       BOOST_LOG_TRIVIAL(debug) |  | ||||||
|          << logPrefix_ << "Time:      " << p->milliseconds_; |  | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ICAO:      " << p->icao_; |  | ||||||
| 
 | 
 | ||||||
|       size_t decompressedRecords = p->DecompressLDMRecords(is); |       size_t decompressedRecords = p->DecompressLDMRecords(is); | ||||||
|       if (decompressedRecords == 0) |       if (decompressedRecords == 0) | ||||||
|  | @ -245,7 +240,7 @@ bool Ar2vFile::LoadData(std::istream& is) | ||||||
| 
 | 
 | ||||||
| size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is) | size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Decompressing LDM Records"; |    logger_->debug("Decompressing LDM Records"); | ||||||
| 
 | 
 | ||||||
|    size_t numRecords = 0; |    size_t numRecords = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -260,8 +255,7 @@ size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is) | ||||||
|       controlWord = ntohl(controlWord); |       controlWord = ntohl(controlWord); | ||||||
|       recordSize  = std::abs(controlWord); |       recordSize  = std::abs(controlWord); | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(trace) |       logger_->trace("LDM Record Found: Size = {} bytes", recordSize); | ||||||
|          << logPrefix_ << "LDM Record Found: Size = " << recordSize << " bytes"; |  | ||||||
| 
 | 
 | ||||||
|       if (recordSize == 0) |       if (recordSize == 0) | ||||||
|       { |       { | ||||||
|  | @ -278,17 +272,14 @@ size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is) | ||||||
|       { |       { | ||||||
|          std::stringstream ss; |          std::stringstream ss; | ||||||
|          std::streamsize   bytesCopied = boost::iostreams::copy(in, ss); |          std::streamsize   bytesCopied = boost::iostreams::copy(in, ss); | ||||||
|          BOOST_LOG_TRIVIAL(trace) |          logger_->trace("Decompressed record size = {} bytes", bytesCopied); | ||||||
|             << logPrefix_ << "Decompressed record size = " << bytesCopied |  | ||||||
|             << " bytes"; |  | ||||||
| 
 | 
 | ||||||
|          rawRecords_.push_back(std::move(ss)); |          rawRecords_.push_back(std::move(ss)); | ||||||
|       } |       } | ||||||
|       catch (const boost::iostreams::bzip2_error& ex) |       catch (const boost::iostreams::bzip2_error& ex) | ||||||
|       { |       { | ||||||
|          int error = ex.error(); |          int error = ex.error(); | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Error decompressing record {}", numRecords); | ||||||
|             << logPrefix_ << "Error decompressing record " << numRecords; |  | ||||||
| 
 | 
 | ||||||
|          is.seekg(startPosition + std::streampos(recordSize), |          is.seekg(startPosition + std::streampos(recordSize), | ||||||
|                   std::ios_base::beg); |                   std::ios_base::beg); | ||||||
|  | @ -297,15 +288,14 @@ size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is) | ||||||
|       ++numRecords; |       ++numRecords; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    BOOST_LOG_TRIVIAL(debug) |    logger_->debug("Decompressed {} LDM Records", numRecords); | ||||||
|       << logPrefix_ << "Decompressed " << numRecords << " LDM Records"; |  | ||||||
| 
 | 
 | ||||||
|    return numRecords; |    return numRecords; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Ar2vFileImpl::ParseLDMRecords() | void Ar2vFileImpl::ParseLDMRecords() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Parsing LDM Records"; |    logger_->debug("Parsing LDM Records"); | ||||||
| 
 | 
 | ||||||
|    size_t count = 0; |    size_t count = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -313,7 +303,7 @@ void Ar2vFileImpl::ParseLDMRecords() | ||||||
|    { |    { | ||||||
|       std::stringstream& ss = *it; |       std::stringstream& ss = *it; | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(trace) << logPrefix_ << "Record " << count++; |       logger_->trace("Record {}", count++); | ||||||
| 
 | 
 | ||||||
|       ParseLDMRecord(ss); |       ParseLDMRecord(ss); | ||||||
|    } |    } | ||||||
|  | @ -346,8 +336,7 @@ void Ar2vFileImpl::ParseLDMRecord(std::istream& is) | ||||||
| 
 | 
 | ||||||
|       if (!is.eof() && offset != 0) |       if (!is.eof() && offset != 0) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(trace) |          logger_->trace("Next record offset by {} bytes", offset); | ||||||
|             << logPrefix_ << "Next record offset by " << offset << " bytes"; |  | ||||||
|       } |       } | ||||||
|       else if (is.eof()) |       else if (is.eof()) | ||||||
|       { |       { | ||||||
|  | @ -382,7 +371,8 @@ void Ar2vFileImpl::HandleMessage(std::shared_ptr<rda::Level2Message>& message) | ||||||
|          std::static_pointer_cast<rda::DigitalRadarData>(message)); |          std::static_pointer_cast<rda::DigitalRadarData>(message)); | ||||||
|       break; |       break; | ||||||
| 
 | 
 | ||||||
|    default: break; |    default: | ||||||
|  |       break; | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -402,12 +392,11 @@ void Ar2vFileImpl::ProcessRadarData( | ||||||
| 
 | 
 | ||||||
| void Ar2vFileImpl::IndexFile() | void Ar2vFileImpl::IndexFile() | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Indexing file"; |    logger_->debug("Indexing file"); | ||||||
| 
 | 
 | ||||||
|    if (vcpData_ == nullptr) |    if (vcpData_ == nullptr) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Cannot index file without VCP data"); | ||||||
|          << logPrefix_ << "Cannot index file without VCP data"; |  | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,20 +1,21 @@ | ||||||
| #include <scwx/wsr88d/level3_file.hpp> | #include <scwx/wsr88d/level3_file.hpp> | ||||||
| #include <scwx/wsr88d/rpg/ccb_header.hpp> | #include <scwx/wsr88d/rpg/ccb_header.hpp> | ||||||
| #include <scwx/wsr88d/rpg/level3_message_factory.hpp> | #include <scwx/wsr88d/rpg/level3_message_factory.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <fstream> | #include <fstream> | ||||||
| 
 | 
 | ||||||
| #include <boost/iostreams/copy.hpp> | #include <boost/iostreams/copy.hpp> | ||||||
| #include <boost/iostreams/filtering_streambuf.hpp> | #include <boost/iostreams/filtering_streambuf.hpp> | ||||||
| #include <boost/iostreams/filter/zlib.hpp> | #include <boost/iostreams/filter/zlib.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::level3_file] "; | static const std::string logPrefix_ = "scwx::wsr88d::level3_file"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class Level3FileImpl | class Level3FileImpl | ||||||
| { | { | ||||||
|  | @ -50,14 +51,13 @@ std::shared_ptr<rpg::Level3Message> Level3File::message() const | ||||||
| 
 | 
 | ||||||
| bool Level3File::LoadFile(const std::string& filename) | bool Level3File::LoadFile(const std::string& filename) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")"; |    logger_->debug("LoadFile: {}", filename); | ||||||
|    bool fileValid = true; |    bool fileValid = true; | ||||||
| 
 | 
 | ||||||
|    std::ifstream f(filename, std::ios_base::in | std::ios_base::binary); |    std::ifstream f(filename, std::ios_base::in | std::ios_base::binary); | ||||||
|    if (!f.good()) |    if (!f.good()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not open file for reading: {}", filename); | ||||||
|          << logPrefix_ << "Could not open file for reading: " << filename; |  | ||||||
|       fileValid = false; |       fileValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -71,7 +71,7 @@ bool Level3File::LoadFile(const std::string& filename) | ||||||
| 
 | 
 | ||||||
| bool Level3File::LoadData(std::istream& is) | bool Level3File::LoadData(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Data"; |    logger_->debug("Loading Data"); | ||||||
| 
 | 
 | ||||||
|    p->wmoHeader_ = std::make_shared<awips::WmoHeader>(); |    p->wmoHeader_ = std::make_shared<awips::WmoHeader>(); | ||||||
| 
 | 
 | ||||||
|  | @ -79,16 +79,11 @@ bool Level3File::LoadData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (dataValid) |    if (dataValid) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Data Type: {}", p->wmoHeader_->data_type()); | ||||||
|          << logPrefix_ << "Data Type: " << p->wmoHeader_->data_type(); |       logger_->debug("ICAO:      {}", p->wmoHeader_->icao()); | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Date/Time: {}", p->wmoHeader_->date_time()); | ||||||
|          << logPrefix_ << "ICAO:      " << p->wmoHeader_->icao(); |       logger_->debug("Category:  {}", p->wmoHeader_->product_category()); | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Site ID:   {}", p->wmoHeader_->product_designator()); | ||||||
|          << logPrefix_ << "Date/Time: " << p->wmoHeader_->date_time(); |  | ||||||
|       BOOST_LOG_TRIVIAL(debug) |  | ||||||
|          << logPrefix_ << "Category:  " << p->wmoHeader_->product_category(); |  | ||||||
|       BOOST_LOG_TRIVIAL(debug) |  | ||||||
|          << logPrefix_ << "Site ID:   " << p->wmoHeader_->product_designator(); |  | ||||||
| 
 | 
 | ||||||
|       // If the header is compressed
 |       // If the header is compressed
 | ||||||
|       if (is.peek() == 0x78) |       if (is.peek() == 0x78) | ||||||
|  | @ -146,20 +141,15 @@ bool Level3FileImpl::DecompressFile(std::istream& is, std::stringstream& ss) | ||||||
|       { |       { | ||||||
|          int error = ex.error(); |          int error = ex.error(); | ||||||
| 
 | 
 | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Error decompressing data: {}", ex.what()); | ||||||
|             << logPrefix_ << "Error decompressing data: " << ex.what(); |  | ||||||
| 
 | 
 | ||||||
|          dataValid = false; |          dataValid = false; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|    if (dataValid) |    if (dataValid) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(trace) |       logger_->trace("Input data consumed = {} bytes", totalBytesCopied); | ||||||
|          << logPrefix_ << "Input data consumed = " << totalBytesCopied |       logger_->trace("Decompressed data size = {} bytes", totalBytesConsumed); | ||||||
|          << " bytes"; |  | ||||||
|       BOOST_LOG_TRIVIAL(trace) |  | ||||||
|          << logPrefix_ << "Decompressed data size = " << totalBytesConsumed |  | ||||||
|          << " bytes"; |  | ||||||
| 
 | 
 | ||||||
|       ccbHeader_ = std::make_shared<rpg::CcbHeader>(); |       ccbHeader_ = std::make_shared<rpg::CcbHeader>(); | ||||||
|       dataValid  = ccbHeader_->Parse(ss); |       dataValid  = ccbHeader_->Parse(ss); | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| #include <scwx/wsr88d/nexrad_file_factory.hpp> | #include <scwx/wsr88d/nexrad_file_factory.hpp> | ||||||
| #include <scwx/wsr88d/ar2v_file.hpp> | #include <scwx/wsr88d/ar2v_file.hpp> | ||||||
| #include <scwx/wsr88d/level3_file.hpp> | #include <scwx/wsr88d/level3_file.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <fstream> | #include <fstream> | ||||||
| #include <sstream> | #include <sstream> | ||||||
|  | @ -8,19 +9,19 @@ | ||||||
| #include <boost/iostreams/copy.hpp> | #include <boost/iostreams/copy.hpp> | ||||||
| #include <boost/iostreams/filtering_streambuf.hpp> | #include <boost/iostreams/filtering_streambuf.hpp> | ||||||
| #include <boost/iostreams/filter/gzip.hpp> | #include <boost/iostreams/filter/gzip.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::nexrad_file_factory] "; | static const std::string logPrefix_ = "scwx::wsr88d::nexrad_file_factory"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| std::shared_ptr<NexradFile> | std::shared_ptr<NexradFile> | ||||||
| NexradFileFactory::Create(const std::string& filename) | NexradFileFactory::Create(const std::string& filename) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Create(" << filename << ")"; |    logger_->debug("Create: {}", filename); | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<NexradFile> nexradFile = nullptr; |    std::shared_ptr<NexradFile> nexradFile = nullptr; | ||||||
|    bool                        fileValid  = true; |    bool                        fileValid  = true; | ||||||
|  | @ -28,8 +29,7 @@ NexradFileFactory::Create(const std::string& filename) | ||||||
|    std::ifstream f(filename, std::ios_base::in | std::ios_base::binary); |    std::ifstream f(filename, std::ios_base::in | std::ios_base::binary); | ||||||
|    if (!f.good()) |    if (!f.good()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Could not open file for reading: {}", filename); | ||||||
|          << logPrefix_ << "Could not open file for reading: " << filename; |  | ||||||
|       fileValid = false; |       fileValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -74,26 +74,23 @@ std::shared_ptr<NexradFile> NexradFileFactory::Create(std::istream& is) | ||||||
|          dataValid = ss.good(); |          dataValid = ss.good(); | ||||||
|          ss.seekg(pisBegin, std::ios_base::beg); |          ss.seekg(pisBegin, std::ios_base::beg); | ||||||
| 
 | 
 | ||||||
|          BOOST_LOG_TRIVIAL(trace) |          logger_->trace("Decompressed file = {} bytes", bytesCopied); | ||||||
|             << logPrefix_ << "Decompressed file = " << bytesCopied << " bytes"; |  | ||||||
| 
 | 
 | ||||||
|          if (!dataValid) |          if (!dataValid) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Error reading decompressed stream"); | ||||||
|                << logPrefix_ << "Error reading decompressed stream"; |  | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
|       catch (const boost::iostreams::gzip_error& ex) |       catch (const boost::iostreams::gzip_error& ex) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Error decompressing file: {}", ex.what()); | ||||||
|             << logPrefix_ << "Error decompressing file: " << ex.what(); |  | ||||||
| 
 | 
 | ||||||
|          dataValid = false; |          dataValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|    else if (!dataValid) |    else if (!dataValid) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Error reading file"; |       logger_->warn("Error reading file"); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (dataValid) |    if (dataValid) | ||||||
|  |  | ||||||
|  | @ -1,9 +1,8 @@ | ||||||
| #include <scwx/wsr88d/rda/clutter_filter_bypass_map.hpp> | #include <scwx/wsr88d/rda/clutter_filter_bypass_map.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -12,7 +11,8 @@ namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rda::clutter_filter_bypass_map] "; |    "scwx::wsr88d::rda::clutter_filter_bypass_map"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class ClutterFilterBypassMapImpl | class ClutterFilterBypassMapImpl | ||||||
| { | { | ||||||
|  | @ -61,8 +61,7 @@ ClutterFilterBypassMap::range_bin(uint16_t e, uint16_t r, uint16_t b) const | ||||||
| 
 | 
 | ||||||
| bool ClutterFilterBypassMap::Parse(std::istream& is) | bool ClutterFilterBypassMap::Parse(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(trace) |    logger_->trace("Parsing Clutter Filter Bypass Map (Message Type 13)"); | ||||||
|       << logPrefix_ << "Parsing Clutter Filter Bypass Map (Message Type 13)"; |  | ||||||
| 
 | 
 | ||||||
|    bool     messageValid         = true; |    bool     messageValid         = true; | ||||||
|    size_t   bytesRead            = 0; |    size_t   bytesRead            = 0; | ||||||
|  | @ -79,21 +78,18 @@ bool ClutterFilterBypassMap::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (p->mapGenerationDate_ < 1) |    if (p->mapGenerationDate_ < 1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid date: {}", p->mapGenerationDate_); | ||||||
|          << logPrefix_ << "Invalid date: " << p->mapGenerationDate_; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    if (p->mapGenerationTime_ > 1440) |    if (p->mapGenerationTime_ > 1440) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid time: {}", p->mapGenerationTime_); | ||||||
|          << logPrefix_ << "Invalid time: " << p->mapGenerationTime_; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    if (numElevationSegments < 1 || numElevationSegments > 5) |    if (numElevationSegments < 1 || numElevationSegments > 5) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid number of elevation segments: {}", | ||||||
|          << logPrefix_ |                     numElevationSegments); | ||||||
|          << "Invalid number of elevation segments: " << numElevationSegments; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,9 +1,8 @@ | ||||||
| #include <scwx/wsr88d/rda/clutter_filter_map.hpp> | #include <scwx/wsr88d/rda/clutter_filter_map.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -11,8 +10,8 @@ namespace wsr88d | ||||||
| namespace rda | namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::rda::clutter_filter_map"; | ||||||
|    "[scwx::wsr88d::rda::clutter_filter_map] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| struct RangeZone | struct RangeZone | ||||||
| { | { | ||||||
|  | @ -75,8 +74,7 @@ uint16_t ClutterFilterMap::end_range(uint16_t e, uint16_t a, uint16_t z) const | ||||||
| 
 | 
 | ||||||
| bool ClutterFilterMap::Parse(std::istream& is) | bool ClutterFilterMap::Parse(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(trace) |    logger_->trace("Parsing Clutter Filter Map (Message Type 15)"); | ||||||
|       << logPrefix_ << "Parsing Clutter Filter Map (Message Type 15)"; |  | ||||||
| 
 | 
 | ||||||
|    bool     messageValid         = true; |    bool     messageValid         = true; | ||||||
|    size_t   bytesRead            = 0; |    size_t   bytesRead            = 0; | ||||||
|  | @ -93,21 +91,18 @@ bool ClutterFilterMap::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (p->mapGenerationDate_ < 1) |    if (p->mapGenerationDate_ < 1) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid date: {}", p->mapGenerationDate_); | ||||||
|          << logPrefix_ << "Invalid date: " << p->mapGenerationDate_; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    if (p->mapGenerationTime_ > 1440) |    if (p->mapGenerationTime_ > 1440) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid time: {}", p->mapGenerationTime_); | ||||||
|          << logPrefix_ << "Invalid time: " << p->mapGenerationTime_; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    if (numElevationSegments < 1 || numElevationSegments > 5) |    if (numElevationSegments < 1 || numElevationSegments > 5) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid number of elevation segments: {}", | ||||||
|          << logPrefix_ |                     numElevationSegments); | ||||||
|          << "Invalid number of elevation segments: " << numElevationSegments; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -132,9 +127,7 @@ bool ClutterFilterMap::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|          if (numRangeZones < 1 || numRangeZones > 20) |          if (numRangeZones < 1 || numRangeZones > 20) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid number of range zones: {}", numRangeZones); | ||||||
|                << logPrefix_ |  | ||||||
|                << "Invalid number of range zones: " << numRangeZones; |  | ||||||
|             messageValid = false; |             messageValid = false; | ||||||
|          } |          } | ||||||
| 
 | 
 | ||||||
|  | @ -158,14 +151,12 @@ bool ClutterFilterMap::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|             if (zone.opCode > 2) |             if (zone.opCode > 2) | ||||||
|             { |             { | ||||||
|                BOOST_LOG_TRIVIAL(warning) |                logger_->warn("Invalid op code: {}", zone.opCode); | ||||||
|                   << logPrefix_ << "Invalid op code: " << zone.opCode; |  | ||||||
|                messageValid = false; |                messageValid = false; | ||||||
|             } |             } | ||||||
|             if (zone.endRange > 511) |             if (zone.endRange > 511) | ||||||
|             { |             { | ||||||
|                BOOST_LOG_TRIVIAL(warning) |                logger_->warn("Invalid end range: {}", zone.endRange); | ||||||
|                   << logPrefix_ << "Invalid end range: " << zone.endRange; |  | ||||||
|                messageValid = false; |                messageValid = false; | ||||||
|             } |             } | ||||||
|          } |          } | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| #include <scwx/wsr88d/rda/digital_radar_data.hpp> | #include <scwx/wsr88d/rda/digital_radar_data.hpp> | ||||||
| 
 | #include <scwx/util/logger.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -9,8 +8,8 @@ namespace wsr88d | ||||||
| namespace rda | namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::rda::digital_radar_data"; | ||||||
|    "[scwx::wsr88d::rda::digital_radar_data] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static const std::unordered_map<std::string, DataBlockType> strToDataBlock_ { | static const std::unordered_map<std::string, DataBlockType> strToDataBlock_ { | ||||||
|    {"VOL", DataBlockType::Volume}, |    {"VOL", DataBlockType::Volume}, | ||||||
|  | @ -145,9 +144,15 @@ const void* MomentDataBlock::data_moments() const | ||||||
| 
 | 
 | ||||||
|    switch (p->dataWordSize_) |    switch (p->dataWordSize_) | ||||||
|    { |    { | ||||||
|    case 8: dataMoments = p->momentGates8_.data(); break; |    case 8: | ||||||
|    case 16: dataMoments = p->momentGates16_.data(); break; |       dataMoments = p->momentGates8_.data(); | ||||||
|    default: dataMoments = nullptr; break; |       break; | ||||||
|  |    case 16: | ||||||
|  |       dataMoments = p->momentGates16_.data(); | ||||||
|  |       break; | ||||||
|  |    default: | ||||||
|  |       dataMoments = nullptr; | ||||||
|  |       break; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return dataMoments; |    return dataMoments; | ||||||
|  | @ -210,16 +215,14 @@ bool MomentDataBlock::Parse(std::istream& is) | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid data word size: {}", p->dataWordSize_); | ||||||
|             << logPrefix_ << "Invalid data word size: " << p->dataWordSize_; |  | ||||||
|          dataBlockValid = false; |          dataBlockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid number of data moment gates: {}", | ||||||
|          << logPrefix_ << "Invalid number of data moment gates: " |                     p->numberOfDataMomentGates_); | ||||||
|          << p->numberOfDataMomentGates_; |  | ||||||
|       dataBlockValid = false; |       dataBlockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -657,8 +660,7 @@ DigitalRadarData::moment_data_block(DataBlockType type) const | ||||||
| 
 | 
 | ||||||
| bool DigitalRadarData::Parse(std::istream& is) | bool DigitalRadarData::Parse(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(trace) |    logger_->trace("Parsing Digital Radar Data (Message Type 31)"); | ||||||
|       << logPrefix_ << "Parsing Digital Radar Data (Message Type 31)"; |  | ||||||
| 
 | 
 | ||||||
|    bool   messageValid = true; |    bool   messageValid = true; | ||||||
|    size_t bytesRead    = 0; |    size_t bytesRead    = 0; | ||||||
|  | @ -694,26 +696,22 @@ bool DigitalRadarData::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (p->azimuthNumber_ < 1 || p->azimuthNumber_ > 720) |    if (p->azimuthNumber_ < 1 || p->azimuthNumber_ > 720) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid azimuth number: {}", p->azimuthNumber_); | ||||||
|          << logPrefix_ << "Invalid azimuth number: " << p->azimuthNumber_; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    if (p->elevationNumber_ < 1 || p->elevationNumber_ > 32) |    if (p->elevationNumber_ < 1 || p->elevationNumber_ > 32) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid elevation number: ", p->elevationNumber_); | ||||||
|          << logPrefix_ << "Invalid elevation number: " << p->elevationNumber_; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    if (p->dataBlockCount_ < 4 || p->dataBlockCount_ > 10) |    if (p->dataBlockCount_ < 4 || p->dataBlockCount_ > 10) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid number of data blocks: {}", p->dataBlockCount_); | ||||||
|          << logPrefix_ |  | ||||||
|          << "Invalid number of data blocks: " << p->dataBlockCount_; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    if (p->compressionIndicator_ != 0) |    if (p->compressionIndicator_ != 0) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Compression not supported"; |       logger_->warn("Compression not supported"); | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -772,8 +770,7 @@ bool DigitalRadarData::Parse(std::istream& is) | ||||||
|             std::move(MomentDataBlock::Create(dataBlockType, dataName, is)); |             std::move(MomentDataBlock::Create(dataBlockType, dataName, is)); | ||||||
|          break; |          break; | ||||||
|       default: |       default: | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Unknown data name: {}", dataName); | ||||||
|             << logPrefix_ << "Unknown data name: " << dataName; |  | ||||||
|          break; |          break; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,7 +1,5 @@ | ||||||
| #include <scwx/wsr88d/rda/level2_message.hpp> | #include <scwx/wsr88d/rda/level2_message.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -9,7 +7,7 @@ namespace wsr88d | ||||||
| namespace rda | namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::rda::level2_message] "; | static const std::string logPrefix_ = "scwx::wsr88d::rda::level2_message"; | ||||||
| 
 | 
 | ||||||
| class Level2MessageImpl | class Level2MessageImpl | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| #include <scwx/wsr88d/rda/level2_message_factory.hpp> | #include <scwx/wsr88d/rda/level2_message_factory.hpp> | ||||||
| 
 | 
 | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/vectorbuf.hpp> | #include <scwx/util/vectorbuf.hpp> | ||||||
| #include <scwx/wsr88d/rda/clutter_filter_bypass_map.hpp> | #include <scwx/wsr88d/rda/clutter_filter_bypass_map.hpp> | ||||||
| #include <scwx/wsr88d/rda/clutter_filter_map.hpp> | #include <scwx/wsr88d/rda/clutter_filter_map.hpp> | ||||||
|  | @ -12,8 +13,6 @@ | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -22,7 +21,8 @@ namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rda::level2_message_factory] "; |    "scwx::wsr88d::rda::level2_message_factory"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| typedef std::function<std::shared_ptr<Level2Message>(Level2MessageHeader&&, | typedef std::function<std::shared_ptr<Level2Message>(Level2MessageHeader&&, | ||||||
|                                                      std::istream&)> |                                                      std::istream&)> | ||||||
|  | @ -51,9 +51,8 @@ Level2MessageInfo Level2MessageFactory::Create(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (info.headerValid && create_.find(header.message_type()) == create_.end()) |    if (info.headerValid && create_.find(header.message_type()) == create_.end()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Unknown message type: {}", | ||||||
|          << logPrefix_ << "Unknown message type: " |                     static_cast<unsigned>(header.message_type())); | ||||||
|          << static_cast<unsigned>(header.message_type()); |  | ||||||
|       info.messageValid = false; |       info.messageValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -68,16 +67,15 @@ Level2MessageInfo Level2MessageFactory::Create(std::istream& is) | ||||||
| 
 | 
 | ||||||
|       if (totalSegments == 1) |       if (totalSegments == 1) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(trace) << logPrefix_ << "Found Message " |          logger_->trace("Found Message {}", static_cast<unsigned>(messageType)); | ||||||
|                                   << static_cast<unsigned>(messageType); |  | ||||||
|          messageStream = &is; |          messageStream = &is; | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(trace) |          logger_->trace("Found Message {} Segment {}/{}", | ||||||
|             << logPrefix_ << "Found Message " |                         static_cast<unsigned>(messageType), | ||||||
|             << static_cast<unsigned>(messageType) << " Segment " << segment |                         segment, | ||||||
|             << "/" << totalSegments; |                         totalSegments); | ||||||
| 
 | 
 | ||||||
|          if (segment == 1) |          if (segment == 1) | ||||||
|          { |          { | ||||||
|  | @ -89,8 +87,7 @@ Level2MessageInfo Level2MessageFactory::Create(std::istream& is) | ||||||
| 
 | 
 | ||||||
|          if (messageData_.capacity() < bufferedSize_ + dataSize) |          if (messageData_.capacity() < bufferedSize_ + dataSize) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(debug) |             logger_->debug("Bad size estimate, increasing size"); | ||||||
|                << logPrefix_ << "Bad size estimate, increasing size"; |  | ||||||
| 
 | 
 | ||||||
|             // Estimate remaining size
 |             // Estimate remaining size
 | ||||||
|             uint16_t remainingSegments = |             uint16_t remainingSegments = | ||||||
|  | @ -105,8 +102,7 @@ Level2MessageInfo Level2MessageFactory::Create(std::istream& is) | ||||||
| 
 | 
 | ||||||
|          if (is.eof()) |          if (is.eof()) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("End of file reached trying to buffer message"); | ||||||
|                << logPrefix_ << "End of file reached trying to buffer message"; |  | ||||||
|             info.messageValid = false; |             info.messageValid = false; | ||||||
|             messageData_.shrink_to_fit(); |             messageData_.shrink_to_fit(); | ||||||
|             bufferedSize_ = 0; |             bufferedSize_ = 0; | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rda/level2_message_header.hpp> | #include <scwx/wsr88d/rda/level2_message_header.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| #ifdef WIN32 | #ifdef WIN32 | ||||||
| #   include <WinSock2.h> | #   include <WinSock2.h> | ||||||
| #else | #else | ||||||
|  | @ -19,7 +18,8 @@ namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rda::level2_message_header] "; |    "scwx::wsr88d::rda::level2_message_header"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class Level2MessageHeaderImpl | class Level2MessageHeaderImpl | ||||||
| { | { | ||||||
|  | @ -123,44 +123,40 @@ bool Level2MessageHeader::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       headerValid = false; |       headerValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->messageSize_ < 9) |       if (p->messageSize_ < 9) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid message size: {}", p->messageSize_); | ||||||
|             << logPrefix_ << "Invalid message size: " << p->messageSize_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if (p->julianDate_ < 1) |       if (p->julianDate_ < 1) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid date: {}", p->julianDate_); | ||||||
|             << logPrefix_ << "Invalid date: " << p->julianDate_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if (p->millisecondsOfDay_ > 86'399'999u) |       if (p->millisecondsOfDay_ > 86'399'999u) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid milliseconds: {}", p->millisecondsOfDay_); | ||||||
|             << logPrefix_ << "Invalid milliseconds: " << p->millisecondsOfDay_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if (p->messageSize_ < 65534 && |       if (p->messageSize_ < 65534 && | ||||||
|           p->messageSegmentNumber_ > p->numberOfMessageSegments_) |           p->messageSegmentNumber_ > p->numberOfMessageSegments_) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid segment = {}/{}", | ||||||
|             << logPrefix_ << "Invalid segment = " << p->messageSegmentNumber_ |                        p->messageSegmentNumber_, | ||||||
|             << "/" << p->numberOfMessageSegments_; |                        p->numberOfMessageSegments_); | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (headerValid) |    if (headerValid) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(trace) |       logger_->trace("Message type: {}", | ||||||
|          << logPrefix_ |                      static_cast<unsigned>(p->messageType_)); | ||||||
|          << "Message type: " << static_cast<unsigned>(p->messageType_); |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return headerValid; |    return headerValid; | ||||||
|  |  | ||||||
|  | @ -1,9 +1,8 @@ | ||||||
| #include <scwx/wsr88d/rda/performance_maintenance_data.hpp> | #include <scwx/wsr88d/rda/performance_maintenance_data.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <array> | #include <array> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -12,7 +11,8 @@ namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rda::performance_maintenance_data] "; |    "scwx::wsr88d::rda::performance_maintenance_data"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class PerformanceMaintenanceDataImpl | class PerformanceMaintenanceDataImpl | ||||||
| { | { | ||||||
|  | @ -1823,8 +1823,7 @@ uint16_t PerformanceMaintenanceData::version() const | ||||||
| 
 | 
 | ||||||
| bool PerformanceMaintenanceData::Parse(std::istream& is) | bool PerformanceMaintenanceData::Parse(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(trace) |    logger_->trace("Parsing Performance/Maintenance Data (Message Type 3)"); | ||||||
|       << logPrefix_ << "Parsing Performance/Maintenance Data (Message Type 3)"; |  | ||||||
| 
 | 
 | ||||||
|    bool   messageValid = true; |    bool   messageValid = true; | ||||||
|    size_t bytesRead    = 0; |    size_t bytesRead    = 0; | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| #include <scwx/wsr88d/rda/rda_adaptation_data.hpp> | #include <scwx/wsr88d/rda/rda_adaptation_data.hpp> | ||||||
| 
 | #include <scwx/util/logger.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -9,8 +8,8 @@ namespace wsr88d | ||||||
| namespace rda | namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::rda::rda_adaptation_data"; | ||||||
|    "[scwx::wsr88d::rda::rda_adaptation_data] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| struct AntManualSetup | struct AntManualSetup | ||||||
| { | { | ||||||
|  | @ -1267,8 +1266,7 @@ float RdaAdaptationData::txb_alarm_thresh() const | ||||||
| 
 | 
 | ||||||
| bool RdaAdaptationData::Parse(std::istream& is) | bool RdaAdaptationData::Parse(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(trace) |    logger_->trace("Parsing RDA Adaptation Data (Message Type 18)"); | ||||||
|       << logPrefix_ << "Parsing RDA Adaptation Data (Message Type 18)"; |  | ||||||
| 
 | 
 | ||||||
|    bool   messageValid = true; |    bool   messageValid = true; | ||||||
|    size_t bytesRead    = 0; |    size_t bytesRead    = 0; | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| #include <scwx/wsr88d/rda/rda_status_data.hpp> | #include <scwx/wsr88d/rda/rda_status_data.hpp> | ||||||
| 
 | #include <scwx/util/logger.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -9,7 +8,8 @@ namespace wsr88d | ||||||
| namespace rda | namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::rda::rda_status_data] "; | static const std::string logPrefix_ = "scwx::wsr88d::rda::rda_status_data"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class RdaStatusDataImpl | class RdaStatusDataImpl | ||||||
| { | { | ||||||
|  | @ -233,8 +233,7 @@ uint16_t RdaStatusData::status_version() const | ||||||
| 
 | 
 | ||||||
| bool RdaStatusData::Parse(std::istream& is) | bool RdaStatusData::Parse(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(trace) |    logger_->trace("Parsing RDA Status Data (Message Type 2)"); | ||||||
|       << logPrefix_ << "Parsing RDA Status Data (Message Type 2)"; |  | ||||||
| 
 | 
 | ||||||
|    bool   messageValid = true; |    bool   messageValid = true; | ||||||
|    size_t bytesRead    = 0; |    size_t bytesRead    = 0; | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| #include <scwx/wsr88d/rda/volume_coverage_pattern_data.hpp> | #include <scwx/wsr88d/rda/volume_coverage_pattern_data.hpp> | ||||||
| 
 | #include <scwx/util/logger.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -10,7 +9,8 @@ namespace rda | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rda::volume_coverage_pattern_data] "; |    "scwx::wsr88d::rda::volume_coverage_pattern_data"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| struct Sector; | struct Sector; | ||||||
| 
 | 
 | ||||||
|  | @ -137,8 +137,12 @@ float VolumeCoveragePatternData::doppler_velocity_resolution() const | ||||||
| 
 | 
 | ||||||
|    switch (p->dopplerVelocityResolution_) |    switch (p->dopplerVelocityResolution_) | ||||||
|    { |    { | ||||||
|    case 2: resolution = 0.5f; break; |    case 2: | ||||||
|    case 4: resolution = 1.0f; break; |       resolution = 0.5f; | ||||||
|  |       break; | ||||||
|  |    case 4: | ||||||
|  |       resolution = 1.0f; | ||||||
|  |       break; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return resolution; |    return resolution; | ||||||
|  | @ -233,12 +237,18 @@ WaveformType VolumeCoveragePatternData::waveform_type(uint16_t e) const | ||||||
| { | { | ||||||
|    switch (p->elevationCuts_[e].waveformType_) |    switch (p->elevationCuts_[e].waveformType_) | ||||||
|    { |    { | ||||||
|    case 1: return WaveformType::ContiguousSurveillance; |    case 1: | ||||||
|    case 2: return WaveformType::ContiguousDopplerWithAmbiguityResolution; |       return WaveformType::ContiguousSurveillance; | ||||||
|    case 3: return WaveformType::ContiguousDopplerWithoutAmbiguityResolution; |    case 2: | ||||||
|    case 4: return WaveformType::Batch; |       return WaveformType::ContiguousDopplerWithAmbiguityResolution; | ||||||
|    case 5: return WaveformType::StaggeredPulsePair; |    case 3: | ||||||
|    default: return WaveformType::Unknown; |       return WaveformType::ContiguousDopplerWithoutAmbiguityResolution; | ||||||
|  |    case 4: | ||||||
|  |       return WaveformType::Batch; | ||||||
|  |    case 5: | ||||||
|  |       return WaveformType::StaggeredPulsePair; | ||||||
|  |    default: | ||||||
|  |       return WaveformType::Unknown; | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -380,8 +390,7 @@ VolumeCoveragePatternData::doppler_prf_pulse_count_radial(uint16_t e, | ||||||
| 
 | 
 | ||||||
| bool VolumeCoveragePatternData::Parse(std::istream& is) | bool VolumeCoveragePatternData::Parse(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(trace) |    logger_->trace("Parsing Volume Coverage Pattern Data (Message Type 5)"); | ||||||
|       << logPrefix_ << "Parsing Volume Coverage Pattern Data (Message Type 5)"; |  | ||||||
| 
 | 
 | ||||||
|    bool   messageValid = true; |    bool   messageValid = true; | ||||||
|    size_t bytesRead    = 0; |    size_t bytesRead    = 0; | ||||||
|  | @ -412,15 +421,13 @@ bool VolumeCoveragePatternData::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (messageSize < 34 || messageSize > 747) |    if (messageSize < 34 || messageSize > 747) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid message size: {}", messageSize); | ||||||
|          << logPrefix_ << "Invalid message size: " << messageSize; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
|    if (numberOfElevationCuts < 1 || numberOfElevationCuts > 32) |    if (numberOfElevationCuts < 1 || numberOfElevationCuts > 32) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid number of elevation cuts: {}", | ||||||
|          << logPrefix_ |                     numberOfElevationCuts); | ||||||
|          << "Invalid number of elevation cuts: " << numberOfElevationCuts; |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -483,9 +490,9 @@ bool VolumeCoveragePatternData::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (messageValid && bytesRead != messageSize * 2) |    if (messageValid && bytesRead != messageSize * 2) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Bytes read ({}) not equal to message size ({})", | ||||||
|          << logPrefix_ << "Bytes read (" << bytesRead |                     bytesRead, | ||||||
|          << ") not equal to message size (" << messageSize * 2 << ")"; |                     messageSize * 2); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (!ValidateMessage(is, bytesRead)) |    if (!ValidateMessage(is, bytesRead)) | ||||||
|  |  | ||||||
|  | @ -1,12 +1,11 @@ | ||||||
| #include <scwx/wsr88d/rpg/ccb_header.hpp> | #include <scwx/wsr88d/rpg/ccb_header.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/streams.hpp> | #include <scwx/util/streams.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <sstream> | #include <sstream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| #ifdef WIN32 | #ifdef WIN32 | ||||||
| #   include <WinSock2.h> | #   include <WinSock2.h> | ||||||
| #else | #else | ||||||
|  | @ -20,7 +19,8 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::rpg::ccb_header] "; | static const std::string logPrefix_ = "scwx::wsr88d::rpg::ccb_header"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class CcbHeaderImpl | class CcbHeaderImpl | ||||||
| { | { | ||||||
|  | @ -197,7 +197,7 @@ bool CcbHeader::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       headerValid = false; |       headerValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/cell_trend_data_packet.hpp> | #include <scwx/wsr88d/rpg/cell_trend_data_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::cell_trend_data_packet] "; |    "scwx::wsr88d::rpg::cell_trend_data_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| struct CellTrendData | struct CellTrendData | ||||||
| { | { | ||||||
|  | @ -134,21 +134,19 @@ bool CellTrendDataPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 21) |       if (p->packetCode_ != 21) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       else if (p->lengthOfBlock_ < 12 || p->lengthOfBlock_ > 198) |       else if (p->lengthOfBlock_ < 12 || p->lengthOfBlock_ > 198) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid length of block: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid length of block: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/cell_trend_volume_scan_times.hpp> | #include <scwx/wsr88d/rpg/cell_trend_volume_scan_times.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::cell_trend_volume_scan_times] "; |    "scwx::wsr88d::rpg::cell_trend_volume_scan_times"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class CellTrendVolumeScanTimesImpl | class CellTrendVolumeScanTimesImpl | ||||||
| { | { | ||||||
|  | @ -93,21 +93,19 @@ bool CellTrendVolumeScanTimes::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 22) |       if (p->packetCode_ != 22) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       else if (p->lengthOfBlock_ < 4 || p->lengthOfBlock_ > 22) |       else if (p->lengthOfBlock_ < 4 || p->lengthOfBlock_ > 22) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid length of block: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid length of block: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/digital_precipitation_data_array_packet.hpp> | #include <scwx/wsr88d/rpg/digital_precipitation_data_array_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::digital_precipitation_data_array_packet] "; |    "scwx::wsr88d::rpg::digital_precipitation_data_array_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class DigitalPrecipitationDataArrayPacketImpl | class DigitalPrecipitationDataArrayPacketImpl | ||||||
| { | { | ||||||
|  | @ -97,21 +97,19 @@ bool DigitalPrecipitationDataArrayPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 17) |       if (p->packetCode_ != 17) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfRows_ != 131) |       if (p->numberOfRows_ != 131) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of rows: {}", p->numberOfRows_); | ||||||
|             << logPrefix_ << "Invalid number of rows: " << p->numberOfRows_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -134,10 +132,9 @@ bool DigitalPrecipitationDataArrayPacket::Parse(std::istream& is) | ||||||
|          if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 262 || |          if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 262 || | ||||||
|              row.numberOfBytes_ % 2 != 0) |              row.numberOfBytes_ % 2 != 0) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid number of bytes in row: {} (Row {})", | ||||||
|                << logPrefix_ |                           row.numberOfBytes_, | ||||||
|                << "Invalid number of bytes in row: " << row.numberOfBytes_ |                           r); | ||||||
|                << " (Row " << r << ")"; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             break; |             break; | ||||||
|          } |          } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/digital_radial_data_array_packet.hpp> | #include <scwx/wsr88d/rpg/digital_radial_data_array_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::digital_radial_data_array_packet] "; |    "scwx::wsr88d::rpg::digital_radial_data_array_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class DigitalRadialDataArrayPacketImpl | class DigitalRadialDataArrayPacketImpl | ||||||
| { | { | ||||||
|  | @ -148,36 +148,31 @@ bool DigitalRadialDataArrayPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 16) |       if (p->packetCode_ != 16) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->indexOfFirstRangeBin_ < 0 || p->indexOfFirstRangeBin_ > 230) |       if (p->indexOfFirstRangeBin_ < 0 || p->indexOfFirstRangeBin_ > 230) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid index of first range bin: {}", | ||||||
|             << logPrefix_ |                        p->indexOfFirstRangeBin_); | ||||||
|             << "Invalid index of first range bin: " << p->indexOfFirstRangeBin_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfRangeBins_ < 0 || p->numberOfRangeBins_ > 1840) |       if (p->numberOfRangeBins_ < 0 || p->numberOfRangeBins_ > 1840) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of range bins: {}", | ||||||
|             << logPrefix_ |                        p->numberOfRangeBins_); | ||||||
|             << "Invalid number of range bins: " << p->numberOfRangeBins_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfRadials_ < 1 || p->numberOfRadials_ > 720) |       if (p->numberOfRadials_ < 1 || p->numberOfRadials_ > 720) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of radials: {}", p->numberOfRadials_); | ||||||
|             << logPrefix_ |  | ||||||
|             << "Invalid number of radials: " << p->numberOfRadials_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -201,19 +196,19 @@ bool DigitalRadialDataArrayPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|          if (radial.numberOfBytes_ < 1 || radial.numberOfBytes_ > 1840) |          if (radial.numberOfBytes_ < 1 || radial.numberOfBytes_ > 1840) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid number of bytes: {} (Radial {})", | ||||||
|                << logPrefix_ |                           radial.numberOfBytes_, | ||||||
|                << "Invalid number of bytes: " << radial.numberOfBytes_ |                           r); | ||||||
|                << " (Radial " << r << ")"; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             break; |             break; | ||||||
|          } |          } | ||||||
|          else if (radial.numberOfBytes_ < p->numberOfRangeBins_) |          else if (radial.numberOfBytes_ < p->numberOfRangeBins_) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn( | ||||||
|                << logPrefix_ << "Number of bytes < number of range bins: " |                "Number of bytes < number of range bins: {} < {} (Radial {})", | ||||||
|                << radial.numberOfBytes_ << " < " << p->numberOfRangeBins_ |                radial.numberOfBytes_, | ||||||
|                << " (Radial " << r << ")"; |                p->numberOfRangeBins_, | ||||||
|  |                r); | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             break; |             break; | ||||||
|          } |          } | ||||||
|  |  | ||||||
|  | @ -4,8 +4,6 @@ | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -14,7 +12,7 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::general_status_message] "; |    "scwx::wsr88d::rpg::general_status_message"; | ||||||
| 
 | 
 | ||||||
| class GeneralStatusMessageImpl | class GeneralStatusMessageImpl | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/generic_data_packet.hpp> | #include <scwx/wsr88d/rpg/generic_data_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -12,8 +11,8 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::rpg::generic_data_packet"; | ||||||
|    "[scwx::wsr88d::rpg::generic_data_packet] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class GenericDataPacketImpl | class GenericDataPacketImpl | ||||||
| { | { | ||||||
|  | @ -70,15 +69,14 @@ bool GenericDataPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 28 && p->packetCode_ != 29) |       if (p->packetCode_ != 28 && p->packetCode_ != 29) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -2,8 +2,6 @@ | ||||||
| 
 | 
 | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -12,7 +10,7 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::generic_radial_data_packet] "; |    "scwx::wsr88d::rpg::generic_radial_data_packet"; | ||||||
| 
 | 
 | ||||||
| class GenericRadialDataPacketImpl | class GenericRadialDataPacketImpl | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -1,11 +1,10 @@ | ||||||
| #include <scwx/wsr88d/rpg/graphic_alphanumeric_block.hpp> | #include <scwx/wsr88d/rpg/graphic_alphanumeric_block.hpp> | ||||||
| #include <scwx/wsr88d/rpg/packet_factory.hpp> | #include <scwx/wsr88d/rpg/packet_factory.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -14,7 +13,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::graphic_alphanumeric_block] "; |    "scwx::wsr88d::rpg::graphic_alphanumeric_block"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class GraphicAlphanumericBlockImpl | class GraphicAlphanumericBlockImpl | ||||||
| { | { | ||||||
|  | @ -76,33 +76,29 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->blockDivider_ != -1) |       if (p->blockDivider_ != -1) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid block divider: {}", p->blockDivider_); | ||||||
|             << logPrefix_ << "Invalid block divider: " << p->blockDivider_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->blockId_ != 2) |       if (p->blockId_ != 2) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid block ID: {}", p->blockId_); | ||||||
|             << logPrefix_ << "Invalid block ID: " << p->blockId_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->lengthOfBlock_ < 10) |       if (p->lengthOfBlock_ < 10) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid block length: {}", p->lengthOfBlock_); | ||||||
|             << logPrefix_ << "Invalid block length: " << p->lengthOfBlock_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfPages_ < 1 || p->numberOfPages_ > 48) |       if (p->numberOfPages_ < 1 || p->numberOfPages_ > 48) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of pages: {}", p->numberOfPages_); | ||||||
|             << logPrefix_ << "Invalid number of pages: " << p->numberOfPages_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -114,7 +110,7 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|       for (uint16_t i = 0; i < p->numberOfPages_; i++) |       for (uint16_t i = 0; i < p->numberOfPages_; i++) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(trace) << logPrefix_ << "Page " << (i + 1); |          logger_->trace("Page {}", (i + 1)); | ||||||
| 
 | 
 | ||||||
|          std::vector<std::shared_ptr<Packet>> packetList; |          std::vector<std::shared_ptr<Packet>> packetList; | ||||||
|          uint32_t                             bytesRead = 0; |          uint32_t                             bytesRead = 0; | ||||||
|  | @ -131,9 +127,8 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|          if (pageNumber != i + 1) |          if (pageNumber != i + 1) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn( | ||||||
|                << logPrefix_ << "Page out of order: Expected " << (i + 1) |                "Page out of order: Expected {}, found {}", (i + 1), pageNumber); | ||||||
|                << ", found " << pageNumber; |  | ||||||
|          } |          } | ||||||
| 
 | 
 | ||||||
|          while (bytesRead < lengthOfPage) |          while (bytesRead < lengthOfPage) | ||||||
|  | @ -152,19 +147,17 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|          if (bytesRead < lengthOfPage) |          if (bytesRead < lengthOfPage) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(trace) |             logger_->trace("Page bytes read smaller than size: {} < {} bytes", | ||||||
|                << logPrefix_ |                            bytesRead, | ||||||
|                << "Page bytes read smaller than size: " << bytesRead << " < " |                            lengthOfPage); | ||||||
|                << lengthOfPage << " bytes"; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             is.seekg(pageEnd, std::ios_base::beg); |             is.seekg(pageEnd, std::ios_base::beg); | ||||||
|          } |          } | ||||||
|          if (bytesRead > lengthOfPage) |          if (bytesRead > lengthOfPage) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Page bytes read larger than size: {} > {} bytes", | ||||||
|                << logPrefix_ |                           bytesRead, | ||||||
|                << "Page bytes read larger than size: " << bytesRead << " > " |                           lengthOfPage); | ||||||
|                << lengthOfPage << " bytes"; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             is.seekg(pageEnd, std::ios_base::beg); |             is.seekg(pageEnd, std::ios_base::beg); | ||||||
|          } |          } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| #include <scwx/wsr88d/rpg/graphic_product_message.hpp> | #include <scwx/wsr88d/rpg/graphic_product_message.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/rangebuf.hpp> | #include <scwx/util/rangebuf.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
|  | @ -7,7 +8,6 @@ | ||||||
| #include <boost/iostreams/copy.hpp> | #include <boost/iostreams/copy.hpp> | ||||||
| #include <boost/iostreams/filtering_streambuf.hpp> | #include <boost/iostreams/filtering_streambuf.hpp> | ||||||
| #include <boost/iostreams/filter/bzip2.hpp> | #include <boost/iostreams/filter/bzip2.hpp> | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -17,7 +17,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::graphic_product_message] "; |    "scwx::wsr88d::rpg::graphic_product_message"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class GraphicProductMessageImpl | class GraphicProductMessageImpl | ||||||
| { | { | ||||||
|  | @ -102,17 +103,14 @@ bool GraphicProductMessage::Parse(std::istream& is) | ||||||
|          { |          { | ||||||
|             std::stringstream ss; |             std::stringstream ss; | ||||||
|             std::streamsize   bytesCopied = boost::iostreams::copy(in, ss); |             std::streamsize   bytesCopied = boost::iostreams::copy(in, ss); | ||||||
|             BOOST_LOG_TRIVIAL(trace) |             logger_->trace("Decompressed data size = {} bytes", bytesCopied); | ||||||
|                << logPrefix_ << "Decompressed data size = " << bytesCopied |  | ||||||
|                << " bytes"; |  | ||||||
| 
 | 
 | ||||||
|             dataValid = p->LoadBlocks(ss); |             dataValid = p->LoadBlocks(ss); | ||||||
|          } |          } | ||||||
|          catch (const boost::iostreams::bzip2_error& ex) |          catch (const boost::iostreams::bzip2_error& ex) | ||||||
|          { |          { | ||||||
|             int error = ex.error(); |             int error = ex.error(); | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Error decompressing data: {}", ex.what()); | ||||||
|                << logPrefix_ << "Error decompressing data: " << ex.what(); |  | ||||||
| 
 | 
 | ||||||
|             dataValid = false; |             dataValid = false; | ||||||
|          } |          } | ||||||
|  | @ -138,7 +136,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is) | ||||||
|    bool graphicValid   = true; |    bool graphicValid   = true; | ||||||
|    bool tabularValid   = true; |    bool tabularValid   = true; | ||||||
| 
 | 
 | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks"; |    logger_->debug("Loading Blocks"); | ||||||
| 
 | 
 | ||||||
|    std::streampos offsetBasePos = is.tellg(); |    std::streampos offsetBasePos = is.tellg(); | ||||||
| 
 | 
 | ||||||
|  | @ -157,8 +155,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is) | ||||||
|       symbologyValid = symbologyBlock_->Parse(is); |       symbologyValid = symbologyBlock_->Parse(is); | ||||||
|       is.seekg(offsetBasePos, std::ios_base::beg); |       is.seekg(offsetBasePos, std::ios_base::beg); | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Product symbology block valid: {}", symbologyValid); | ||||||
|          << logPrefix_ << "Product symbology block valid: " << symbologyValid; |  | ||||||
| 
 | 
 | ||||||
|       if (!symbologyValid) |       if (!symbologyValid) | ||||||
|       { |       { | ||||||
|  | @ -174,8 +171,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is) | ||||||
|       graphicValid = graphicBlock_->Parse(is); |       graphicValid = graphicBlock_->Parse(is); | ||||||
|       is.seekg(offsetBasePos, std::ios_base::beg); |       is.seekg(offsetBasePos, std::ios_base::beg); | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Graphic alphanumeric block valid: {}", graphicValid); | ||||||
|          << logPrefix_ << "Graphic alphanumeric block valid: " << graphicValid; |  | ||||||
| 
 | 
 | ||||||
|       if (!graphicValid) |       if (!graphicValid) | ||||||
|       { |       { | ||||||
|  | @ -191,8 +187,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is) | ||||||
|       tabularValid = tabularBlock_->Parse(is); |       tabularValid = tabularBlock_->Parse(is); | ||||||
|       is.seekg(offsetBasePos, std::ios_base::beg); |       is.seekg(offsetBasePos, std::ios_base::beg); | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Tabular alphanumeric block valid: {}", tabularValid); | ||||||
|          << logPrefix_ << "Tabular alphanumeric block valid: " << tabularValid; |  | ||||||
| 
 | 
 | ||||||
|       if (!tabularValid) |       if (!tabularValid) | ||||||
|       { |       { | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/hda_hail_symbol_packet.hpp> | #include <scwx/wsr88d/rpg/hda_hail_symbol_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::hda_hail_symbol_packet] "; |    "scwx::wsr88d::rpg::hda_hail_symbol_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| struct HdaHailSymbol | struct HdaHailSymbol | ||||||
| { | { | ||||||
|  | @ -90,8 +90,7 @@ bool HdaHailSymbolPacket::ParseData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (packet_code() != 19) |    if (packet_code() != 19) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid packet code: {}", packet_code()); | ||||||
|          << logPrefix_ << "Invalid packet code: " << packet_code(); |  | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,5 @@ | ||||||
| #include <scwx/wsr88d/rpg/level3_message.hpp> | #include <scwx/wsr88d/rpg/level3_message.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -9,7 +7,7 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::rpg::level3_message] "; | static const std::string logPrefix_ = "scwx::wsr88d::rpg::level3_message"; | ||||||
| 
 | 
 | ||||||
| class Level3MessageImpl | class Level3MessageImpl | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| #include <scwx/wsr88d/rpg/level3_message_factory.hpp> | #include <scwx/wsr88d/rpg/level3_message_factory.hpp> | ||||||
| 
 | 
 | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/vectorbuf.hpp> | #include <scwx/util/vectorbuf.hpp> | ||||||
| #include <scwx/wsr88d/rpg/general_status_message.hpp> | #include <scwx/wsr88d/rpg/general_status_message.hpp> | ||||||
| #include <scwx/wsr88d/rpg/graphic_product_message.hpp> | #include <scwx/wsr88d/rpg/graphic_product_message.hpp> | ||||||
|  | @ -9,8 +10,6 @@ | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -19,7 +18,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::level3_message_factory] "; |    "scwx::wsr88d::rpg::level3_message_factory"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| typedef std::function<std::shared_ptr<Level3Message>(Level3MessageHeader&&, | typedef std::function<std::shared_ptr<Level3Message>(Level3MessageHeader&&, | ||||||
|                                                      std::istream&)> |                                                      std::istream&)> | ||||||
|  | @ -133,8 +133,7 @@ std::shared_ptr<Level3Message> Level3MessageFactory::Create(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (headerValid && create_.find(header.message_code()) == create_.end()) |    if (headerValid && create_.find(header.message_code()) == create_.end()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Unknown message type: {}", header.message_code()); | ||||||
|          << logPrefix_ << "Unknown message type: " << header.message_code(); |  | ||||||
|       messageValid = false; |       messageValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -143,7 +142,7 @@ std::shared_ptr<Level3Message> Level3MessageFactory::Create(std::istream& is) | ||||||
|       int16_t messageCode = header.message_code(); |       int16_t messageCode = header.message_code(); | ||||||
|       size_t  dataSize = header.length_of_message() - Level3MessageHeader::SIZE; |       size_t  dataSize = header.length_of_message() - Level3MessageHeader::SIZE; | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Found Message " << messageCode; |       logger_->debug("Found Message {}", messageCode); | ||||||
| 
 | 
 | ||||||
|       message = create_.at(messageCode)(std::move(header), is); |       message = create_.at(messageCode)(std::move(header), is); | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/level3_message_header.hpp> | #include <scwx/wsr88d/rpg/level3_message_header.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| #ifdef WIN32 | #ifdef WIN32 | ||||||
| #   include <WinSock2.h> | #   include <WinSock2.h> | ||||||
| #else | #else | ||||||
|  | @ -19,7 +18,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::level3_message_header] "; |    "scwx::wsr88d::rpg::level3_message_header"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class Level3MessageHeaderImpl | class Level3MessageHeaderImpl | ||||||
| { | { | ||||||
|  | @ -113,7 +113,7 @@ bool Level3MessageHeader::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       headerValid = false; |       headerValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|  | @ -122,52 +122,44 @@ bool Level3MessageHeader::Parse(std::istream& is) | ||||||
|           (p->messageCode_ > -16 && p->messageCode_ < 0) || |           (p->messageCode_ > -16 && p->messageCode_ < 0) || | ||||||
|           p->messageCode_ > 211) |           p->messageCode_ > 211) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid message code: {}", p->messageCode_); | ||||||
|             << logPrefix_ << "Invalid message code: " << p->messageCode_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if (p->dateOfMessage_ > 32'767u) |       if (p->dateOfMessage_ > 32'767u) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid date: {}", p->dateOfMessage_); | ||||||
|             << logPrefix_ << "Invalid date: " << p->dateOfMessage_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if (p->timeOfMessage_ > 86'399u) |       if (p->timeOfMessage_ > 86'399u) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid time: {}", p->timeOfMessage_); | ||||||
|             << logPrefix_ << "Invalid time: " << p->timeOfMessage_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if (p->lengthOfMessage_ < 18 || p->lengthOfMessage_ > 1'329'270u) |       if (p->lengthOfMessage_ < 18 || p->lengthOfMessage_ > 1'329'270u) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid length: {}", p->lengthOfMessage_); | ||||||
|             << logPrefix_ << "Invalid length: " << p->lengthOfMessage_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if ((p->sourceId_ > 999u && p->sourceId_ < 3000) || p->sourceId_ > 3045) |       if ((p->sourceId_ > 999u && p->sourceId_ < 3000) || p->sourceId_ > 3045) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid source ID: {}", p->sourceId_); | ||||||
|             << logPrefix_ << "Invalid source ID: " << p->sourceId_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if (p->destinationId_ > 999u) |       if (p->destinationId_ > 999u) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid destination ID: {}", p->destinationId_); | ||||||
|             << logPrefix_ << "Invalid destination ID: " << p->destinationId_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberBlocks_ < 1u || p->numberBlocks_ > 51u) |       if (p->numberBlocks_ < 1u || p->numberBlocks_ > 51u) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid block count: {}", p->numberBlocks_); | ||||||
|             << logPrefix_ << "Invalid block count: " << p->numberBlocks_; |  | ||||||
|          headerValid = false; |          headerValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (headerValid) |    if (headerValid) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(trace) |       logger_->trace("Message code: {}", p->messageCode_); | ||||||
|          << logPrefix_ << "Message code: " << p->messageCode_; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    return headerValid; |    return headerValid; | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/linked_contour_vector_packet.hpp> | #include <scwx/wsr88d/rpg/linked_contour_vector_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::linked_contour_vector_packet] "; |    "scwx::wsr88d::rpg::linked_contour_vector_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class LinkedContourVectorPacketImpl | class LinkedContourVectorPacketImpl | ||||||
| { | { | ||||||
|  | @ -93,22 +93,20 @@ bool LinkedContourVectorPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 0x0E03) |       if (p->packetCode_ != 0x0E03) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->initialPointIndicator_ != 0x8000) |       if (p->initialPointIndicator_ != 0x8000) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid initial point indicator: {}", | ||||||
|             << logPrefix_ |                        p->initialPointIndicator_); | ||||||
|             << "Invalid initial point indicator: " << p->initialPointIndicator_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/linked_vector_packet.hpp> | #include <scwx/wsr88d/rpg/linked_vector_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -12,8 +11,8 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::rpg::linked_vector_packet"; | ||||||
|    "[scwx::wsr88d::rpg::linked_vector_packet] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class LinkedVectorPacketImpl | class LinkedVectorPacketImpl | ||||||
| { | { | ||||||
|  | @ -93,7 +92,7 @@ bool LinkedVectorPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else if (p->packetCode_ == 9) |    else if (p->packetCode_ == 9) | ||||||
|  | @ -107,8 +106,7 @@ bool LinkedVectorPacket::Parse(std::istream& is) | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 6 && p->packetCode_ != 9) |       if (p->packetCode_ != 6 && p->packetCode_ != 9) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,11 +1,10 @@ | ||||||
| #include <scwx/wsr88d/rpg/mesocyclone_symbol_packet.hpp> | #include <scwx/wsr88d/rpg/mesocyclone_symbol_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <set> | #include <set> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -14,7 +13,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::mesocyclone_symbol_packet] "; |    "scwx::wsr88d::rpg::mesocyclone_symbol_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static const std::set<uint16_t> packetCodes_ = {3, 11}; | static const std::set<uint16_t> packetCodes_ = {3, 11}; | ||||||
| 
 | 
 | ||||||
|  | @ -77,8 +77,7 @@ bool MesocycloneSymbolPacket::ParseData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (!packetCodes_.contains(packet_code())) |    if (!packetCodes_.contains(packet_code())) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid packet code: {}", packet_code()); | ||||||
|          << logPrefix_ << "Invalid packet code: " << packet_code(); |  | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::rpg::packet] "; | static const std::string logPrefix_ = "scwx::wsr88d::rpg::packet"; | ||||||
| 
 | 
 | ||||||
| Packet::Packet()  = default; | Packet::Packet()  = default; | ||||||
| Packet::~Packet() = default; | Packet::~Packet() = default; | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| #include <scwx/wsr88d/rpg/packet_factory.hpp> | #include <scwx/wsr88d/rpg/packet_factory.hpp> | ||||||
| 
 | 
 | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/wsr88d/rpg/cell_trend_data_packet.hpp> | #include <scwx/wsr88d/rpg/cell_trend_data_packet.hpp> | ||||||
| #include <scwx/wsr88d/rpg/cell_trend_volume_scan_times.hpp> | #include <scwx/wsr88d/rpg/cell_trend_volume_scan_times.hpp> | ||||||
| #include <scwx/wsr88d/rpg/digital_precipitation_data_array_packet.hpp> | #include <scwx/wsr88d/rpg/digital_precipitation_data_array_packet.hpp> | ||||||
|  | @ -26,8 +27,6 @@ | ||||||
| 
 | 
 | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -35,7 +34,8 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "[scwx::wsr88d::rpg::packet_factory] "; | static const std::string logPrefix_ = "scwx::wsr88d::rpg::packet_factory"; | ||||||
|  | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| typedef std::function<std::shared_ptr<Packet>(std::istream&)> | typedef std::function<std::shared_ptr<Packet>(std::istream&)> | ||||||
|    CreateMessageFunction; |    CreateMessageFunction; | ||||||
|  | @ -95,17 +95,13 @@ std::shared_ptr<Packet> PacketFactory::Create(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (packetValid && create_.find(packetCode) == create_.end()) |    if (packetValid && create_.find(packetCode) == create_.end()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Unknown packet code: {0} (0x{0:x})", packetCode); | ||||||
|          << logPrefix_ << "Unknown packet code: " << packetCode << " (0x" |  | ||||||
|          << std::hex << packetCode << std::dec << ")"; |  | ||||||
|       packetValid = false; |       packetValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (packetValid) |    if (packetValid) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(trace) |       logger_->trace("Found packet code: {0} (0x{0:x})", packetCode); | ||||||
|          << logPrefix_ << "Found packet code: " << packetCode << " (0x" |  | ||||||
|          << std::hex << packetCode << std::dec << ")"; |  | ||||||
|       packet = create_.at(packetCode)(is); |       packet = create_.at(packetCode)(is); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/point_feature_symbol_packet.hpp> | #include <scwx/wsr88d/rpg/point_feature_symbol_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::point_feature_symbol_packet] "; |    "scwx::wsr88d::rpg::point_feature_symbol_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| struct PointFeature | struct PointFeature | ||||||
| { | { | ||||||
|  | @ -95,8 +95,7 @@ bool PointFeatureSymbolPacket::ParseData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (packet_code() != 20) |    if (packet_code() != 20) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid packet code: {}", packet_code()); | ||||||
|          << logPrefix_ << "Invalid packet code: " << packet_code(); |  | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,11 +1,10 @@ | ||||||
| #include <scwx/wsr88d/rpg/point_graphic_symbol_packet.hpp> | #include <scwx/wsr88d/rpg/point_graphic_symbol_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <set> | #include <set> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -14,7 +13,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::point_graphic_symbol_packet] "; |    "scwx::wsr88d::rpg::point_graphic_symbol_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static const std::set<uint16_t> packetCodes_ = {12, 13, 14, 26}; | static const std::set<uint16_t> packetCodes_ = {12, 13, 14, 26}; | ||||||
| 
 | 
 | ||||||
|  | @ -70,8 +70,7 @@ bool PointGraphicSymbolPacket::ParseData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (!packetCodes_.contains(packet_code())) |    if (!packetCodes_.contains(packet_code())) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid packet code: {}", packet_code()); | ||||||
|          << logPrefix_ << "Invalid packet code: " << packet_code(); |  | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/precipitation_rate_data_array_packet.hpp> | #include <scwx/wsr88d/rpg/precipitation_rate_data_array_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::precipitation_rate_data_array_packet] "; |    "scwx::wsr88d::rpg::precipitation_rate_data_array_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class PrecipitationRateDataArrayPacketImpl | class PrecipitationRateDataArrayPacketImpl | ||||||
| { | { | ||||||
|  | @ -94,21 +94,19 @@ bool PrecipitationRateDataArrayPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 18) |       if (p->packetCode_ != 18) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfRows_ != 13) |       if (p->numberOfRows_ != 13) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of rows: {}", p->numberOfRows_); | ||||||
|             << logPrefix_ << "Invalid number of rows: " << p->numberOfRows_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -131,10 +129,9 @@ bool PrecipitationRateDataArrayPacket::Parse(std::istream& is) | ||||||
|          if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 14 || |          if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 14 || | ||||||
|              row.numberOfBytes_ % 2 != 0) |              row.numberOfBytes_ % 2 != 0) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid number of bytes in row: {} (Row {})", | ||||||
|                << logPrefix_ |                           row.numberOfBytes_, | ||||||
|                << "Invalid number of bytes in row: " << row.numberOfBytes_ |                           r); | ||||||
|                << " (Row " << r << ")"; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             break; |             break; | ||||||
|          } |          } | ||||||
|  |  | ||||||
|  | @ -1,13 +1,12 @@ | ||||||
| #include <scwx/wsr88d/rpg/product_description_block.hpp> | #include <scwx/wsr88d/rpg/product_description_block.hpp> | ||||||
| #include <scwx/util/float.hpp> | #include <scwx/util/float.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <array> | #include <array> | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <set> | #include <set> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -16,7 +15,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::product_description_block] "; |    "scwx::wsr88d::rpg::product_description_block"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static const std::set<int16_t> compressedProducts_ = { | static const std::set<int16_t> compressedProducts_ = { | ||||||
|    32,  94,  99,  134, 135, 138, 149, 152, 153, 154, 155, |    32,  94,  99,  134, 135, 138, 149, 152, 153, 154, 155, | ||||||
|  | @ -660,31 +660,28 @@ bool ProductDescriptionBlock::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->blockDivider_ != -1) |       if (p->blockDivider_ != -1) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid block divider: {}", p->blockDivider_); | ||||||
|             << logPrefix_ << "Invalid block divider: " << p->blockDivider_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->productCode_ < -299 || |       if (p->productCode_ < -299 || | ||||||
|           (p->productCode_ > -16 && p->productCode_ < 16) || |           (p->productCode_ > -16 && p->productCode_ < 16) || | ||||||
|           p->productCode_ > 299) |           p->productCode_ > 299) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid product code: {}", p->productCode_); | ||||||
|             << logPrefix_ << "Invalid product code: " << p->productCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (blockValid) |    if (blockValid) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(trace) |       logger_->trace("Product code: {}", p->productCode_); | ||||||
|          << logPrefix_ << "Product code: " << p->productCode_; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    const std::streampos blockEnd = is.tellg(); |    const std::streampos blockEnd = is.tellg(); | ||||||
|  |  | ||||||
|  | @ -1,11 +1,10 @@ | ||||||
| #include <scwx/wsr88d/rpg/product_symbology_block.hpp> | #include <scwx/wsr88d/rpg/product_symbology_block.hpp> | ||||||
| #include <scwx/wsr88d/rpg/packet_factory.hpp> | #include <scwx/wsr88d/rpg/packet_factory.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -14,7 +13,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::product_symbology_block] "; |    "scwx::wsr88d::rpg::product_symbology_block"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class ProductSymbologyBlockImpl | class ProductSymbologyBlockImpl | ||||||
| { | { | ||||||
|  | @ -87,33 +87,29 @@ bool ProductSymbologyBlock::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->blockDivider_ != -1) |       if (p->blockDivider_ != -1) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid block divider: {}", p->blockDivider_); | ||||||
|             << logPrefix_ << "Invalid block divider: " << p->blockDivider_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->blockId_ != 1) |       if (p->blockId_ != 1) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid block ID: {}", p->blockId_); | ||||||
|             << logPrefix_ << "Invalid block ID: " << p->blockId_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->lengthOfBlock_ < 10) |       if (p->lengthOfBlock_ < 10) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid block length: {}", p->lengthOfBlock_); | ||||||
|             << logPrefix_ << "Invalid block length: " << p->lengthOfBlock_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfLayers_ < 1 || p->numberOfLayers_ > 18) |       if (p->numberOfLayers_ < 1 || p->numberOfLayers_ > 18) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of layers: {}", p->numberOfLayers_); | ||||||
|             << logPrefix_ << "Invalid number of layers: " << p->numberOfLayers_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -125,7 +121,7 @@ bool ProductSymbologyBlock::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|       for (uint16_t i = 0; i < p->numberOfLayers_; i++) |       for (uint16_t i = 0; i < p->numberOfLayers_; i++) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(trace) << logPrefix_ << "Layer " << i; |          logger_->trace("Layer {}", i); | ||||||
| 
 | 
 | ||||||
|          std::vector<std::shared_ptr<Packet>> packetList; |          std::vector<std::shared_ptr<Packet>> packetList; | ||||||
|          uint32_t                             bytesRead = 0; |          uint32_t                             bytesRead = 0; | ||||||
|  | @ -156,19 +152,17 @@ bool ProductSymbologyBlock::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|          if (bytesRead < lengthOfDataLayer) |          if (bytesRead < lengthOfDataLayer) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(trace) |             logger_->trace("Layer bytes read smaller than size: {} < {} bytes", | ||||||
|                << logPrefix_ |                            bytesRead, | ||||||
|                << "Layer bytes read smaller than size: " << bytesRead << " < " |                            lengthOfDataLayer); | ||||||
|                << lengthOfDataLayer << " bytes"; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             is.seekg(layerEnd, std::ios_base::beg); |             is.seekg(layerEnd, std::ios_base::beg); | ||||||
|          } |          } | ||||||
|          if (bytesRead > lengthOfDataLayer) |          if (bytesRead > lengthOfDataLayer) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Layer bytes read larger than size: {} > {} bytes", | ||||||
|                << logPrefix_ |                           bytesRead, | ||||||
|                << "Layer bytes read larger than size: " << bytesRead << " > " |                           lengthOfDataLayer); | ||||||
|                << lengthOfDataLayer << " bytes"; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             is.seekg(layerEnd, std::ios_base::beg); |             is.seekg(layerEnd, std::ios_base::beg); | ||||||
|          } |          } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/radar_coded_message.hpp> | #include <scwx/wsr88d/rpg/radar_coded_message.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -12,8 +11,8 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::rpg::radar_coded_message"; | ||||||
|    "[scwx::wsr88d::rpg::radar_coded_message] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class RadarCodedMessageImpl | class RadarCodedMessageImpl | ||||||
| { | { | ||||||
|  | @ -77,7 +76,7 @@ bool RadarCodedMessage::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
| bool RadarCodedMessageImpl::LoadBlocks(std::istream& is) | bool RadarCodedMessageImpl::LoadBlocks(std::istream& is) | ||||||
| { | { | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks"; |    logger_->debug("Loading Blocks"); | ||||||
| 
 | 
 | ||||||
|    pupSiteIdentifier_.resize(4); |    pupSiteIdentifier_.resize(4); | ||||||
|    productCategory_.resize(5); |    productCategory_.resize(5); | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/radial_data_packet.hpp> | #include <scwx/wsr88d/rpg/radial_data_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -12,8 +11,8 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::rpg::radial_data_packet"; | ||||||
|    "[scwx::wsr88d::rpg::radial_data_packet] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class RadialDataPacketImpl | class RadialDataPacketImpl | ||||||
| { | { | ||||||
|  | @ -152,29 +151,25 @@ bool RadialDataPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 0xAF1F) |       if (p->packetCode_ != 0xAF1F) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfRangeBins_ < 1 || p->numberOfRangeBins_ > 460) |       if (p->numberOfRangeBins_ < 1 || p->numberOfRangeBins_ > 460) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of range bins: {}", | ||||||
|             << logPrefix_ |                        p->numberOfRangeBins_); | ||||||
|             << "Invalid number of range bins: " << p->numberOfRangeBins_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfRadials_ < 1 || p->numberOfRadials_ > 400) |       if (p->numberOfRadials_ < 1 || p->numberOfRadials_ > 400) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of radials: {}", p->numberOfRadials_); | ||||||
|             << logPrefix_ |  | ||||||
|             << "Invalid number of radials: " << p->numberOfRadials_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -199,9 +194,9 @@ bool RadialDataPacket::Parse(std::istream& is) | ||||||
|          if (radial.numberOfRleHalfwords_ < 1 || |          if (radial.numberOfRleHalfwords_ < 1 || | ||||||
|              radial.numberOfRleHalfwords_ > 230) |              radial.numberOfRleHalfwords_ > 230) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid number of RLE halfwords: {} (Radial {})", | ||||||
|                << logPrefix_ << "Invalid number of RLE halfwords: " |                           radial.numberOfRleHalfwords_, | ||||||
|                << radial.numberOfRleHalfwords_ << " (Radial " << r << ")"; |                           r); | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             break; |             break; | ||||||
|          } |          } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/raster_data_packet.hpp> | #include <scwx/wsr88d/rpg/raster_data_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -12,8 +11,8 @@ namespace wsr88d | ||||||
| namespace rpg | namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = "scwx::wsr88d::rpg::raster_data_packet"; | ||||||
|    "[scwx::wsr88d::rpg::raster_data_packet] "; | static const auto        logger_    = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class RasterDataPacketImpl | class RasterDataPacketImpl | ||||||
| { | { | ||||||
|  | @ -162,21 +161,19 @@ bool RasterDataPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 0xBA0F && p->packetCode_ != 0xBA07) |       if (p->packetCode_ != 0xBA0F && p->packetCode_ != 0xBA07) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfRows_ < 1 || p->numberOfRows_ > 464) |       if (p->numberOfRows_ < 1 || p->numberOfRows_ > 464) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of rows: {}", p->numberOfRows_); | ||||||
|             << logPrefix_ << "Invalid number of rows: " << p->numberOfRows_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -199,10 +196,9 @@ bool RasterDataPacket::Parse(std::istream& is) | ||||||
|          if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 920 || |          if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 920 || | ||||||
|              row.numberOfBytes_ % 2 != 0) |              row.numberOfBytes_ % 2 != 0) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid number of bytes in row: {} (Row {})", | ||||||
|                << logPrefix_ |                           row.numberOfBytes_, | ||||||
|                << "Invalid number of bytes in row: " << row.numberOfBytes_ |                           r); | ||||||
|                << " (Row " << r << ")"; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|             break; |             break; | ||||||
|          } |          } | ||||||
|  |  | ||||||
|  | @ -1,11 +1,10 @@ | ||||||
| #include <scwx/wsr88d/rpg/scit_forecast_data_packet.hpp> | #include <scwx/wsr88d/rpg/scit_forecast_data_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <set> | #include <set> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -14,7 +13,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::scit_forecast_data_packet] "; |    "scwx::wsr88d::rpg::scit_forecast_data_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static const std::set<uint16_t> packetCodes_ = {23, 24}; | static const std::set<uint16_t> packetCodes_ = {23, 24}; | ||||||
| 
 | 
 | ||||||
|  | @ -55,8 +55,7 @@ bool ScitForecastDataPacket::ParseData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (!packetCodes_.contains(packet_code())) |    if (!packetCodes_.contains(packet_code())) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid packet code: {}", packet_code()); | ||||||
|          << logPrefix_ << "Invalid packet code: " << packet_code(); |  | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/set_color_level_packet.hpp> | #include <scwx/wsr88d/rpg/set_color_level_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::set_color_level_packet] "; |    "scwx::wsr88d::rpg::set_color_level_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class SetColorLevelPacketImpl | class SetColorLevelPacketImpl | ||||||
| { | { | ||||||
|  | @ -76,22 +76,20 @@ bool SetColorLevelPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 0x0802) |       if (p->packetCode_ != 0x0802) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->colorValueIndicator_ != 0x0002) |       if (p->colorValueIndicator_ != 0x0002) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid color value indicator: {}", | ||||||
|             << logPrefix_ |                        p->colorValueIndicator_); | ||||||
|             << "Invalid color value indicator: " << p->colorValueIndicator_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,11 +1,10 @@ | ||||||
| #include <scwx/wsr88d/rpg/special_graphic_symbol_packet.hpp> | #include <scwx/wsr88d/rpg/special_graphic_symbol_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <set> | #include <set> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -14,7 +13,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::special_graphic_symbol_packet] "; |    "scwx::wsr88d::rpg::special_graphic_symbol_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| static const std::set<uint16_t> packetCodes_ = { | static const std::set<uint16_t> packetCodes_ = { | ||||||
|    3, 11, 12, 13, 14, 15, 19, 20, 23, 24, 25, 26}; |    3, 11, 12, 13, 14, 15, 19, 20, 23, 24, 25, 26}; | ||||||
|  | @ -72,7 +72,7 @@ bool SpecialGraphicSymbolPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|  | @ -82,15 +82,13 @@ bool SpecialGraphicSymbolPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|       if (!packetCodes_.contains(p->packetCode_)) |       if (!packetCodes_.contains(p->packetCode_)) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       else if (p->lengthOfBlock_ < minBlockLength || |       else if (p->lengthOfBlock_ < minBlockLength || | ||||||
|                p->lengthOfBlock_ > maxBlockLength) |                p->lengthOfBlock_ > maxBlockLength) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid length of block: {}", p->lengthOfBlock_); | ||||||
|             << logPrefix_ << "Invalid length of block: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/sti_circle_symbol_packet.hpp> | #include <scwx/wsr88d/rpg/sti_circle_symbol_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::sti_circle_symbol_packet] "; |    "scwx::wsr88d::rpg::sti_circle_symbol_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| struct StiCircleSymbol | struct StiCircleSymbol | ||||||
| { | { | ||||||
|  | @ -71,8 +71,7 @@ bool StiCircleSymbolPacket::ParseData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (packet_code() != 25) |    if (packet_code() != 25) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid packet code: {}", packet_code()); | ||||||
|          << logPrefix_ << "Invalid packet code: " << packet_code(); |  | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/storm_id_symbol_packet.hpp> | #include <scwx/wsr88d/rpg/storm_id_symbol_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::storm_id_symbol_packet] "; |    "scwx::wsr88d::rpg::storm_id_symbol_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| struct StormIdSymbol | struct StormIdSymbol | ||||||
| { | { | ||||||
|  | @ -71,8 +71,7 @@ bool StormIdSymbolPacket::ParseData(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (packet_code() != 15) |    if (packet_code() != 15) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Invalid packet code: {}", packet_code()); | ||||||
|          << logPrefix_ << "Invalid packet code: " << packet_code(); |  | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,12 +2,11 @@ | ||||||
| #include <scwx/wsr88d/rpg/level3_message_header.hpp> | #include <scwx/wsr88d/rpg/level3_message_header.hpp> | ||||||
| #include <scwx/wsr88d/rpg/packet_factory.hpp> | #include <scwx/wsr88d/rpg/packet_factory.hpp> | ||||||
| #include <scwx/wsr88d/rpg/product_description_block.hpp> | #include <scwx/wsr88d/rpg/product_description_block.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -16,7 +15,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::tabular_alphanumeric_block] "; |    "scwx::wsr88d::rpg::tabular_alphanumeric_block"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class TabularAlphanumericBlockImpl | class TabularAlphanumericBlockImpl | ||||||
| { | { | ||||||
|  | @ -92,28 +92,24 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader) | ||||||
| 
 | 
 | ||||||
|       if (is.eof()) |       if (is.eof()) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |          logger_->debug("Reached end of file"); | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|       { |       { | ||||||
|          if (p->blockDivider1_ != -1) |          if (p->blockDivider1_ != -1) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid first block divider: {}", p->blockDivider1_); | ||||||
|                << logPrefix_ |  | ||||||
|                << "Invalid first block divider: " << p->blockDivider1_; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|          } |          } | ||||||
|          if (p->blockId_ != 3) |          if (p->blockId_ != 3) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid block ID: {}", p->blockId_); | ||||||
|                << logPrefix_ << "Invalid block ID: " << p->blockId_; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|          } |          } | ||||||
|          if (p->lengthOfBlock_ < 10) |          if (p->lengthOfBlock_ < 10) | ||||||
|          { |          { | ||||||
|             BOOST_LOG_TRIVIAL(warning) |             logger_->warn("Invalid block length: {}", p->lengthOfBlock_); | ||||||
|                << logPrefix_ << "Invalid block length: " << p->lengthOfBlock_; |  | ||||||
|             blockValid = false; |             blockValid = false; | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
|  | @ -151,15 +147,12 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader) | ||||||
| 
 | 
 | ||||||
|       if (p->blockDivider2_ != -1) |       if (p->blockDivider2_ != -1) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid second block divider: {}", p->blockDivider2_); | ||||||
|             << logPrefix_ |  | ||||||
|             << "Invalid second block divider: " << p->blockDivider2_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       if (p->numberOfPages_ < 1 || p->numberOfPages_ > 48) |       if (p->numberOfPages_ < 1 || p->numberOfPages_ > 48) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid number of pages: {}", p->numberOfPages_); | ||||||
|             << logPrefix_ << "Invalid number of pages: " << p->numberOfPages_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  | @ -184,10 +177,9 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader) | ||||||
|             } |             } | ||||||
|             else if (numberOfCharacters > 80) |             else if (numberOfCharacters > 80) | ||||||
|             { |             { | ||||||
|                BOOST_LOG_TRIVIAL(warning) |                logger_->warn("Invalid number of characters: {} (Page {})", | ||||||
|                   << logPrefix_ |                              numberOfCharacters, | ||||||
|                   << "Invalid number of characters: " << numberOfCharacters |                              (i + 1)); | ||||||
|                   << " (Page " << (i + 1) << ")"; |  | ||||||
|                blockValid = false; |                blockValid = false; | ||||||
|                break; |                break; | ||||||
|             } |             } | ||||||
|  | @ -211,7 +203,7 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader) | ||||||
|    } |    } | ||||||
|    else if (skipHeader && is.eof()) |    else if (skipHeader && is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/tabular_product_message.hpp> | #include <scwx/wsr88d/rpg/tabular_product_message.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::tabular_product_message] "; |    "scwx::wsr88d::rpg::tabular_product_message"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class TabularProductMessageImpl | class TabularProductMessageImpl | ||||||
| { | { | ||||||
|  | @ -82,7 +82,7 @@ bool TabularProductMessageImpl::LoadBlocks(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    bool tabularValid = true; |    bool tabularValid = true; | ||||||
| 
 | 
 | ||||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks"; |    logger_->debug("Loading Blocks"); | ||||||
| 
 | 
 | ||||||
|    std::streampos offsetBasePos = is.tellg(); |    std::streampos offsetBasePos = is.tellg(); | ||||||
| 
 | 
 | ||||||
|  | @ -99,8 +99,7 @@ bool TabularProductMessageImpl::LoadBlocks(std::istream& is) | ||||||
|       tabularValid = tabularBlock_->Parse(is, skipTabularHeader); |       tabularValid = tabularBlock_->Parse(is, skipTabularHeader); | ||||||
|       is.seekg(offsetBasePos, std::ios_base::beg); |       is.seekg(offsetBasePos, std::ios_base::beg); | ||||||
| 
 | 
 | ||||||
|       BOOST_LOG_TRIVIAL(debug) |       logger_->debug("Tabular alphanumeric block valid: {}", tabularValid); | ||||||
|          << logPrefix_ << "Tabular alphanumeric block valid: " << tabularValid; |  | ||||||
| 
 | 
 | ||||||
|       if (!tabularValid) |       if (!tabularValid) | ||||||
|       { |       { | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/text_and_special_symbol_packet.hpp> | #include <scwx/wsr88d/rpg/text_and_special_symbol_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::text_and_special_symbol_packet] "; |    "scwx::wsr88d::rpg::text_and_special_symbol_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class TextAndSpecialSymbolPacketImpl | class TextAndSpecialSymbolPacketImpl | ||||||
| { | { | ||||||
|  | @ -113,21 +113,19 @@ bool TextAndSpecialSymbolPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 1 && p->packetCode_ != 2 && p->packetCode_ != 8) |       if (p->packetCode_ != 1 && p->packetCode_ != 2 && p->packetCode_ != 8) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       else if (p->lengthOfBlock_ < 1 || p->lengthOfBlock_ > 32767) |       else if (p->lengthOfBlock_ < 1 || p->lengthOfBlock_ > 32767) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid length of block: {}", p->lengthOfBlock_); | ||||||
|             << logPrefix_ << "Invalid length of block: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|       else if (p->packetCode_ == 8) |       else if (p->packetCode_ == 8) | ||||||
|  | @ -141,8 +139,7 @@ bool TextAndSpecialSymbolPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (blockValid && textLength < 0) |    if (blockValid && textLength < 0) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(warning) |       logger_->warn("Too few bytes in block: {}", p->lengthOfBlock_); | ||||||
|          << logPrefix_ << "Too few bytes in block: " << p->lengthOfBlock_; |  | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| #include <scwx/wsr88d/rpg/unlinked_contour_vector_packet.hpp> | #include <scwx/wsr88d/rpg/unlinked_contour_vector_packet.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
| 
 | 
 | ||||||
| #include <istream> | #include <istream> | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include <boost/log/trivial.hpp> |  | ||||||
| 
 |  | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
| namespace wsr88d | namespace wsr88d | ||||||
|  | @ -13,7 +12,8 @@ namespace rpg | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = | static const std::string logPrefix_ = | ||||||
|    "[scwx::wsr88d::rpg::unlinked_contour_vector_packet] "; |    "scwx::wsr88d::rpg::unlinked_contour_vector_packet"; | ||||||
|  | static const auto logger_ = util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
| class UnlinkedContourVectorPacketImpl | class UnlinkedContourVectorPacketImpl | ||||||
| { | { | ||||||
|  | @ -80,15 +80,14 @@ bool UnlinkedContourVectorPacket::Parse(std::istream& is) | ||||||
| 
 | 
 | ||||||
|    if (is.eof()) |    if (is.eof()) | ||||||
|    { |    { | ||||||
|       BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file"; |       logger_->debug("Reached end of file"); | ||||||
|       blockValid = false; |       blockValid = false; | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       if (p->packetCode_ != 0x3501) |       if (p->packetCode_ != 0x3501) | ||||||
|       { |       { | ||||||
|          BOOST_LOG_TRIVIAL(warning) |          logger_->warn("Invalid packet code: {}", p->packetCode_); | ||||||
|             << logPrefix_ << "Invalid packet code: " << p->packetCode_; |  | ||||||
|          blockValid = false; |          blockValid = false; | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat