Merge branch 'feature/spdlog' into develop

This commit is contained in:
Dan Paulat 2022-04-19 16:18:58 -05:00
commit 2723ad1966
104 changed files with 780 additions and 946 deletions

View file

@ -19,6 +19,7 @@ conan_cmake_configure(REQUIRES boost/1.78.0
glm/0.9.9.8
gtest/cci.20210126
openssl/1.1.1n
spdlog/1.10.0
vulkan-loader/1.3.204.1
GENERATORS cmake
cmake_find_package

View file

@ -206,10 +206,6 @@ qt6_create_translation_scwx(QM_FILES ${scwx-qt_SOURCE_DIR} ${TS_FILES})
if (WIN32)
target_compile_definitions(scwx-qt 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()
target_include_directories(scwx-qt PUBLIC ${scwx-qt_SOURCE_DIR}/source

View file

@ -1,11 +1,10 @@
#include <scwx/qt/config/radar_site.hpp>
#include <scwx/qt/util/json.hpp>
#include <scwx/common/sites.hpp>
#include <scwx/util/logger.hpp>
#include <unordered_map>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -13,7 +12,8 @@ namespace qt
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_ =
":/res/config/radar_sites.json";
@ -121,8 +121,7 @@ void RadarSite::Initialize()
size_t RadarSite::ReadConfig(const std::string& path)
{
BOOST_LOG_TRIVIAL(info) << logPrefix_ << "Loading radar sites from \""
<< path << "\"...";
logger_->info("Loading radar sites from \"{}\"...", path);
bool dataValid = true;
size_t sitesAdded = 0;
@ -139,7 +138,7 @@ size_t RadarSite::ReadConfig(const std::string& path)
if (!ValidateJsonEntry(o))
{
BOOST_LOG_TRIVIAL(info) << logPrefix_ << "Incorrect format: " << v;
logger_->info("Incorrect format: {}", boost::json::serialize(v));
}
else
{
@ -168,9 +167,9 @@ size_t RadarSite::ReadConfig(const std::string& path)
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Site ID conflict: " << siteIdMap_.at(siteId)
<< " and " << site->p->id_;
logger_->warn("Site ID conflict: {} and {}",
siteIdMap_.at(siteId),
site->p->id_);
}
}
}

View file

@ -1,6 +1,6 @@
#include <scwx/qt/gl/draw/draw_item.hpp>
#include <boost/log/trivial.hpp>
#include <string>
namespace scwx
{
@ -11,7 +11,7 @@ namespace gl
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
{

View file

@ -2,8 +2,6 @@
#include <optional>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -13,7 +11,7 @@ namespace gl
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_TRIANGLES = NUM_RECTANGLES * 2;

View file

@ -7,8 +7,7 @@
GLenum err; \
while ((err = gl.glGetError()) != GL_NO_ERROR) \
{ \
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "GL Error: " << err \
<< ", " __FILE__ << ":" << __LINE__; \
logger_->error("GL Error: {}, {}: {}", err, __FILE__, __LINE__); \
} \
}

View file

@ -1,9 +1,8 @@
#include <scwx/qt/gl/shader_program.hpp>
#include <scwx/util/logger.hpp>
#include <QFile>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -11,7 +10,8 @@ namespace qt
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;
@ -53,8 +53,7 @@ GLuint ShaderProgram::id() const
bool ShaderProgram::Load(const std::string& vertexPath,
const std::string& fragmentPath)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Load(\"" << vertexPath << "\", \""
<< fragmentPath << "\")";
logger_->debug("Load: {}, {}", vertexPath, fragmentPath);
OpenGLFunctions& gl = p->gl_;
@ -71,15 +70,13 @@ bool ShaderProgram::Load(const std::string& vertexPath,
if (!vertexFile.isOpen())
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Could not load vertex shader: " << vertexPath;
logger_->error("Could not load vertex shader: {}", vertexPath);
return false;
}
if (!fragmentFile.isOpen())
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Could not load fragment shader: " << fragmentPath;
logger_->error("Could not load fragment shader: {}", fragmentPath);
return false;
}
@ -108,14 +105,12 @@ bool ShaderProgram::Load(const std::string& vertexPath,
gl.glGetShaderInfoLog(vertexShader, INFO_LOG_BUF_SIZE, &logLength, infoLog);
if (!glSuccess)
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Vertex shader compilation failed: " << infoLog;
logger_->error("Vertex shader compilation failed: {}", infoLog);
success = false;
}
else if (logLength > 0)
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Vertex shader compiled with warnings: " << infoLog;
logger_->error("Vertex shader compiled with warnings: {}", infoLog);
}
// Create a fragment shader
@ -131,14 +126,12 @@ bool ShaderProgram::Load(const std::string& vertexPath,
fragmentShader, INFO_LOG_BUF_SIZE, &logLength, infoLog);
if (!glSuccess)
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Fragment shader compilation failed: " << infoLog;
logger_->error("Fragment shader compilation failed: {}", infoLog);
success = false;
}
else if (logLength > 0)
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Fragment shader compiled with warnings: " << infoLog;
logger_->error("Fragment shader compiled with warnings: {}", infoLog);
}
if (success)
@ -152,14 +145,12 @@ bool ShaderProgram::Load(const std::string& vertexPath,
gl.glGetProgramInfoLog(p->id_, INFO_LOG_BUF_SIZE, &logLength, infoLog);
if (!glSuccess)
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Shader program link failed: " << infoLog;
logger_->error("Shader program link failed: {}", infoLog);
success = false;
}
else if (logLength > 0)
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Shader program linked with warnings: " << infoLog;
logger_->error("Shader program linked with warnings: {}", infoLog);
}
}

View file

@ -1,6 +1,6 @@
#include <scwx/qt/gl/text_shader.hpp>
#include <scwx/util/logger.hpp>
#include <boost/log/trivial.hpp>
#include <glm/gtc/type_ptr.hpp>
namespace scwx
@ -10,7 +10,8 @@ namespace qt
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
{
@ -46,7 +47,7 @@ bool TextShader::Initialize()
p->projectionLocation_ = gl.glGetUniformLocation(id(), "projection");
if (p->projectionLocation_ == -1)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find projection";
logger_->warn("Could not find projection");
}
return success;

View file

@ -2,15 +2,15 @@
#include <scwx/qt/main/main_window.hpp>
#include <scwx/qt/manager/resource_manager.hpp>
#include <scwx/qt/manager/settings_manager.hpp>
#include <scwx/util/logger.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/trivial.hpp>
#include <spdlog/spdlog.h>
#include <QApplication>
int main(int argc, char* argv[])
{
boost::log::core::get()->set_filter(boost::log::trivial::severity >=
boost::log::trivial::debug);
scwx::util::Logger::Initialize();
spdlog::set_level(spdlog::level::debug);
QCoreApplication::setApplicationName("Supercell Wx");

View file

@ -10,6 +10,7 @@
#include <scwx/common/characters.hpp>
#include <scwx/common/products.hpp>
#include <scwx/common/vcp.hpp>
#include <scwx/util/logger.hpp>
#include <QFileDialog>
#include <QMessageBox>
@ -17,8 +18,6 @@
#include <QStandardPaths>
#include <QToolButton>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -26,7 +25,8 @@ namespace qt
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
{
@ -51,10 +51,9 @@ public:
{
if (!std::filesystem::create_directories(appDataPath))
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_
<< "Unable to create application local data directory: \""
<< appDataPath << "\"";
logger_->error(
"Unable to create application local data directory: \"{}\"",
appDataPath);
}
}
@ -253,7 +252,7 @@ void MainWindow::on_actionOpen_triggered()
this,
[=](const QString& file)
{
BOOST_LOG_TRIVIAL(info) << "Selected: " << file.toStdString();
logger_->info("Selected: {}", file.toStdString());
std::shared_ptr<request::NexradFileRequest> request =
std::make_shared<request::NexradFileRequest>();
@ -397,8 +396,7 @@ void MainWindowImpl::SelectRadarProduct(map::MapWidget* mapWidget,
{
const std::string& productName = common::GetLevel2Name(product);
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Selecting Level 2 radar product: " << productName;
logger_->debug("Selecting Level 2 radar product: {}", productName);
if (mapWidget == activeMap_)
{

View file

@ -1,6 +1,7 @@
#include <scwx/qt/manager/radar_product_manager.hpp>
#include <scwx/common/constants.hpp>
#include <scwx/util/threads.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/wsr88d/nexrad_file_factory.hpp>
#include <deque>
@ -8,7 +9,6 @@
#include <mutex>
#include <shared_mutex>
#include <boost/log/trivial.hpp>
#include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp>
#include <GeographicLib/Geodesic.hpp>
@ -22,7 +22,8 @@ namespace manager
{
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>()>
CreateNexradFileFunction;
@ -59,8 +60,7 @@ public:
{
if (radarSite_ == nullptr)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Radar site not found: \"" << radarId_ << "\"";
logger_->warn("Radar site not found: \"{}\"", radarId_);
radarSite_ = std::make_shared<config::RadarSite>();
}
}
@ -130,7 +130,7 @@ void RadarProductManager::Initialize()
return;
}
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()";
logger_->debug("Initialize()");
boost::timer::cpu_timer timer;
@ -176,9 +176,8 @@ void RadarProductManager::Initialize()
coordinates0_5Degree[offset + 1] = longitude;
});
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Coordinates (0.5 degree) calculated in "
<< timer.format(6, "%ws");
logger_->debug("Coordinates (0.5 degree) calculated in {}",
timer.format(6, "%ws"));
// Calculate 1 degree azimuth coordinates
timer.start();
@ -214,9 +213,8 @@ void RadarProductManager::Initialize()
coordinates1Degree[offset + 1] = longitude;
});
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Coordinates (1 degree) calculated in "
<< timer.format(6, "%ws");
logger_->debug("Coordinates (1 degree) calculated in {}",
timer.format(6, "%ws"));
p->initialized_ = true;
}
@ -224,7 +222,7 @@ void RadarProductManager::Initialize()
void RadarProductManager::LoadData(
std::istream& is, std::shared_ptr<request::NexradFileRequest> request)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadData()";
logger_->debug("LoadData()");
RadarProductManagerImpl::LoadNexradFile(
[=, &is]() -> std::shared_ptr<wsr88d::NexradFile>
@ -236,7 +234,7 @@ void RadarProductManager::LoadFile(
const std::string& filename,
std::shared_ptr<request::NexradFileRequest> request)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")";
logger_->debug("LoadFile: {}", filename);
std::shared_ptr<types::RadarProductRecord> existingRecord = nullptr;
@ -245,8 +243,7 @@ void RadarProductManager::LoadFile(
auto it = fileIndex_.find(filename);
if (it != fileIndex_.cend())
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "File previously loaded, loading from file cache";
logger_->debug("File previously loaded, loading from file cache");
existingRecord = it->second;
}
@ -385,7 +382,7 @@ std::shared_ptr<types::RadarProductRecord>
RadarProductManagerImpl::StoreRadarProductRecord(
std::shared_ptr<types::RadarProductRecord> record)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "StoreRadarProductRecord()";
logger_->debug("StoreRadarProductRecord()");
std::shared_ptr<types::RadarProductRecord> storedRecord = record;
@ -394,9 +391,8 @@ RadarProductManagerImpl::StoreRadarProductRecord(
auto it = level2ProductRecords_.find(record->time());
if (it != level2ProductRecords_.cend())
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_
<< "Level 2 product previously loaded, loading from cache";
logger_->debug(
"Level 2 product previously loaded, loading from cache");
storedRecord = it->second;
}
@ -412,9 +408,8 @@ RadarProductManagerImpl::StoreRadarProductRecord(
auto it = productMap.find(record->time());
if (it != productMap.cend())
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_
<< "Level 3 product previously loaded, loading from cache";
logger_->debug(
"Level 3 product previously loaded, loading from cache");
storedRecord = it->second;
}

View file

@ -1,5 +1,6 @@
#include <scwx/qt/manager/settings_manager.hpp>
#include <scwx/qt/util/json.hpp>
#include <scwx/util/logger.hpp>
#include <filesystem>
#include <fstream>
@ -7,8 +8,6 @@
#include <QDir>
#include <QStandardPaths>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -18,7 +17,8 @@ namespace manager
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::PaletteSettings> paletteSettings_ = nullptr;
@ -37,9 +37,8 @@ void Initialize()
{
if (!std::filesystem::create_directories(appDataPath))
{
BOOST_LOG_TRIVIAL(error)
<< logPrefix_ << "Unable to create application data directory: \""
<< appDataPath << "\"";
logger_->error("Unable to create application data directory: \"{}\"",
appDataPath);
}
}
@ -97,7 +96,7 @@ static boost::json::value ConvertSettingsToJson()
static void GenerateDefaultSettings()
{
BOOST_LOG_TRIVIAL(info) << logPrefix_ << "Generating default settings";
logger_->info("Generating default settings");
generalSettings_ = settings::GeneralSettings::Create();
paletteSettings_ = settings::PaletteSettings::Create();
@ -105,7 +104,7 @@ static void GenerateDefaultSettings()
static bool LoadSettings(const boost::json::object& settingsJson)
{
BOOST_LOG_TRIVIAL(info) << logPrefix_ << "Loading settings";
logger_->info("Loading settings");
bool jsonDirty = false;

View file

@ -1,7 +1,7 @@
#include <scwx/qt/map/color_table_layer.hpp>
#include <scwx/qt/gl/shader_program.hpp>
#include <scwx/util/logger.hpp>
#include <boost/log/trivial.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
@ -12,7 +12,8 @@ namespace qt
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
{
@ -47,7 +48,7 @@ ColorTableLayer::~ColorTableLayer() = default;
void ColorTableLayer::Initialize()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()";
logger_->debug("Initialize()");
gl::OpenGLFunctions& gl = context()->gl_;
@ -58,7 +59,7 @@ void ColorTableLayer::Initialize()
gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix");
if (p->uMVPMatrixLocation_ == -1)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find uMVPMatrix";
logger_->warn("Could not find uMVPMatrix");
}
gl.glGenTextures(1, &p->texture_);
@ -170,7 +171,7 @@ void ColorTableLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
void ColorTableLayer::Deinitialize()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Deinitialize()";
logger_->debug("Deinitialize()");
gl::OpenGLFunctions& gl = context()->gl_;

View file

@ -1,7 +1,7 @@
#include <scwx/qt/map/draw_layer.hpp>
#include <scwx/qt/gl/shader_program.hpp>
#include <scwx/util/logger.hpp>
#include <boost/log/trivial.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
@ -13,7 +13,8 @@ namespace qt
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
{
@ -47,7 +48,7 @@ void DrawLayer::Initialize()
gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix");
if (p->uMVPMatrixLocation_ == -1)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find uMVPMatrix";
logger_->warn("Could not find uMVPMatrix");
}
p->shaderProgram_.Use();

View file

@ -8,6 +8,7 @@
#include <scwx/qt/map/radar_product_layer.hpp>
#include <scwx/qt/map/radar_range_layer.hpp>
#include <scwx/qt/view/radar_product_view_factory.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/threads.hpp>
#include <scwx/util/time.hpp>
@ -20,8 +21,6 @@
#include <QMouseEvent>
#include <QString>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -29,7 +28,8 @@ namespace qt
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;
@ -309,10 +309,11 @@ void MapWidget::SelectRadarProduct(
productCode = level3File->message()->header().message_code();
}
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "SelectRadarProduct(" << radarId << ", "
<< common::GetRadarProductGroupName(group) << ", " << product << ", "
<< util::TimeString(time) << ")";
logger_->debug("SelectRadarProduct: {}, {}, {}, {}",
radarId,
common::GetRadarProductGroupName(group),
product,
util::TimeString(time));
if (group == common::RadarProductGroup::Level2)
{
@ -335,8 +336,7 @@ void MapWidget::SelectRadarProduct(
if (radarProductView == nullptr)
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "No view created for product";
logger_->debug("No view created for product");
return;
}

View file

@ -3,6 +3,7 @@
#include <scwx/qt/gl/shader_program.hpp>
#include <scwx/qt/gl/text_shader.hpp>
#include <scwx/qt/util/font.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/time.hpp>
#include <chrono>
@ -10,7 +11,6 @@
#include <boost/date_time.hpp>
#include <boost/date_time/local_time/local_time.hpp>
#include <boost/log/trivial.hpp>
#include <boost/timer/timer.hpp>
#include <GeographicLib/Geodesic.hpp>
#include <glm/glm.hpp>
@ -25,7 +25,8 @@ namespace qt
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
{
@ -74,7 +75,7 @@ OverlayLayer::~OverlayLayer() = default;
void OverlayLayer::Initialize()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()";
logger_->debug("Initialize()");
DrawLayer::Initialize();
@ -154,7 +155,7 @@ void OverlayLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
void OverlayLayer::Deinitialize()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Deinitialize()";
logger_->debug("Deinitialize()");
DrawLayer::Deinitialize();

View file

@ -1,9 +1,9 @@
#include <scwx/qt/map/radar_product_layer.hpp>
#include <scwx/qt/gl/shader_program.hpp>
#include <scwx/util/logger.hpp>
#include <execution>
#include <boost/log/trivial.hpp>
#include <boost/timer/timer.hpp>
#include <GeographicLib/Geodesic.hpp>
#include <glm/glm.hpp>
@ -21,7 +21,8 @@ namespace map
static constexpr uint32_t MAX_RADIALS = 720;
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
LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate);
@ -73,7 +74,7 @@ RadarProductLayer::~RadarProductLayer() = default;
void RadarProductLayer::Initialize()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()";
logger_->debug("Initialize()");
gl::OpenGLFunctions& gl = context()->gl_;
@ -84,38 +85,35 @@ void RadarProductLayer::Initialize()
gl.glGetUniformLocation(p->shaderProgram_.id(), "uMVPMatrix");
if (p->uMVPMatrixLocation_ == -1)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find uMVPMatrix";
logger_->warn("Could not find uMVPMatrix");
}
p->uMapScreenCoordLocation_ =
gl.glGetUniformLocation(p->shaderProgram_.id(), "uMapScreenCoord");
if (p->uMapScreenCoordLocation_ == -1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not find uMapScreenCoord";
logger_->warn("Could not find uMapScreenCoord");
}
p->uDataMomentOffsetLocation_ =
gl.glGetUniformLocation(p->shaderProgram_.id(), "uDataMomentOffset");
if (p->uDataMomentOffsetLocation_ == -1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not find uDataMomentOffset";
logger_->warn("Could not find uDataMomentOffset");
}
p->uDataMomentScaleLocation_ =
gl.glGetUniformLocation(p->shaderProgram_.id(), "uDataMomentScale");
if (p->uDataMomentScaleLocation_ == -1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not find uDataMomentScale";
logger_->warn("Could not find uDataMomentScale");
}
p->uCFPEnabledLocation_ =
gl.glGetUniformLocation(p->shaderProgram_.id(), "uCFPEnabled");
if (p->uCFPEnabledLocation_ == -1)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Could not find uCFPEnabled";
logger_->warn("Could not find uCFPEnabled");
}
p->shaderProgram_.Use();
@ -148,7 +146,7 @@ void RadarProductLayer::Initialize()
void RadarProductLayer::UpdateSweep()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateSweep()";
logger_->debug("UpdateSweep()");
gl::OpenGLFunctions& gl = context()->gl_;
@ -161,8 +159,7 @@ void RadarProductLayer::UpdateSweep()
std::try_to_lock);
if (!sweepLock.owns_lock())
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Sweep locked, deferring update";
logger_->debug("Sweep locked, deferring update");
return;
}
@ -181,8 +178,7 @@ void RadarProductLayer::UpdateSweep()
vertices.data(),
GL_STATIC_DRAW);
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Vertices buffered in " << timer.format(6, "%ws");
logger_->debug("Vertices buffered in {}", timer.format(6, "%ws"));
gl.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
gl.glEnableVertexAttribArray(0);
@ -208,8 +204,7 @@ void RadarProductLayer::UpdateSweep()
timer.start();
gl.glBufferData(GL_ARRAY_BUFFER, dataSize, data, GL_STATIC_DRAW);
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Data moments buffered in " << timer.format(6, "%ws");
logger_->debug("Data moments buffered in {}", timer.format(6, "%ws"));
gl.glVertexAttribIPointer(1, 1, type, 0, static_cast<void*>(0));
gl.glEnableVertexAttribArray(1);
@ -238,8 +233,7 @@ void RadarProductLayer::UpdateSweep()
timer.start();
gl.glBufferData(GL_ARRAY_BUFFER, cfpDataSize, cfpData, GL_STATIC_DRAW);
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "CFP moments buffered in " << timer.format(6, "%ws");
logger_->debug("CFP moments buffered in {}", timer.format(6, "%ws"));
gl.glVertexAttribIPointer(2, 1, cfpType, 0, static_cast<void*>(0));
gl.glEnableVertexAttribArray(2);
@ -294,11 +288,13 @@ void RadarProductLayer::Render(
gl.glBindTexture(GL_TEXTURE_1D, p->texture_);
gl.glBindVertexArray(p->vao_);
gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_);
SCWX_GL_CHECK_ERROR();
}
void RadarProductLayer::Deinitialize()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Deinitialize()";
logger_->debug("Deinitialize()");
gl::OpenGLFunctions& gl = context()->gl_;
@ -317,7 +313,7 @@ void RadarProductLayer::Deinitialize()
void RadarProductLayer::UpdateColorTable()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateColorTable()";
logger_->debug("UpdateColorTable()");
p->colorTableNeedsUpdate_ = false;

View file

@ -1,6 +1,6 @@
#include <scwx/qt/map/radar_range_layer.hpp>
#include <scwx/util/logger.hpp>
#include <boost/log/trivial.hpp>
#include <GeographicLib/Geodesic.hpp>
#include <glm/glm.hpp>
@ -11,7 +11,8 @@ namespace qt
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>
GetRangeCircle(float range, QMapbox::Coordinate center);
@ -21,7 +22,7 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapboxGL> map,
QMapbox::Coordinate center,
const QString& before)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Add()";
logger_->debug("Add()");
if (map->layerExists("rangeCircleLayer"))
{

View file

@ -1,7 +1,5 @@
#include <scwx/qt/request/nexrad_file_request.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -9,8 +7,7 @@ namespace qt
namespace request
{
static const std::string logPrefix_ =
"[scwx::qt::request::nexrad_file_request] ";
static const std::string logPrefix_ = "scwx::qt::request::nexrad_file_request";
class NexradFileRequestImpl
{

View file

@ -1,7 +1,6 @@
#include <scwx/qt/settings/general_settings.hpp>
#include <scwx/qt/util/json.hpp>
#include <boost/log/trivial.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
@ -10,7 +9,8 @@ namespace qt
namespace settings
{
static const std::string logPrefix_ = "[scwx::qt::settings::general_settings] ";
static const std::string logPrefix_ = "scwx::qt::settings::general_settings";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static const std::string DEFAULT_DEFAULT_RADAR_SITE = "KLSX";
static const int64_t DEFAULT_GRID_WIDTH = 1;
@ -115,13 +115,11 @@ GeneralSettings::Load(const boost::json::value* json, bool& jsonDirty)
{
if (json == nullptr)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Key is not present, resetting to defaults";
logger_->warn("Key is not present, resetting to defaults");
}
else if (!json->is_object())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid json, resetting to defaults";
logger_->warn("Invalid json, resetting to defaults");
}
generalSettings->p->SetDefaults();

View file

@ -1,7 +1,6 @@
#include <scwx/qt/settings/palette_settings.hpp>
#include <scwx/qt/util/json.hpp>
#include <boost/log/trivial.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
@ -10,7 +9,8 @@ namespace qt
namespace settings
{
static const std::string logPrefix_ = "[scwx::qt::settings::palette_settings] ";
static const std::string logPrefix_ = "scwx::qt::settings::palette_settings";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static const std::vector<std::string> paletteNames_ = {
// Level 2 / Common Products
@ -125,13 +125,11 @@ PaletteSettings::Load(const boost::json::value* json, bool& jsonDirty)
{
if (json == nullptr)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Key is not present, resetting to defaults";
logger_->warn("Key is not present, resetting to defaults");
}
else if (!json->is_object())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid json, resetting to defaults";
logger_->warn("Invalid json, resetting to defaults");
}
generalSettings->p->SetDefaults();

View file

@ -3,8 +3,6 @@
#include <scwx/common/sites.hpp>
#include <scwx/util/time.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -12,8 +10,7 @@ namespace qt
namespace types
{
static const std::string logPrefix_ =
"[scwx::qt::types::radar_product_record] ";
static const std::string logPrefix_ = "scwx::qt::types::radar_product_record";
class RadarProductRecordImpl
{

View file

@ -2,11 +2,11 @@
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#include <scwx/qt/util/font.hpp>
#include <scwx/util/logger.hpp>
#include <codecvt>
#include <unordered_map>
#include <boost/log/trivial.hpp>
#include <boost/timer/timer.hpp>
#include <QFile>
#include <QFileInfo>
@ -76,7 +76,8 @@ static const std::string CODEPOINTS =
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";
static const std::string logPrefix_ = "[scwx::qt::util::font] ";
static const std::string logPrefix_ = "scwx::qt::util::font";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static constexpr float BASE_POINT_SIZE = 72.0f;
static constexpr float POINT_SCALE = 1.0f / BASE_POINT_SIZE;
@ -144,9 +145,8 @@ float Font::BufferText(std::shared_ptr<FontBuffer> buffer,
auto it = p->glyphs_.find(c);
if (it == p->glyphs_.end())
{
BOOST_LOG_TRIVIAL(info)
<< logPrefix_
<< "Could not draw character: " << static_cast<uint32_t>(c);
logger_->info("Could not draw character: {}",
static_cast<uint32_t>(c));
continue;
}
@ -198,9 +198,7 @@ float Font::TextLength(const std::string& text, float pointSize) const
auto it = p->glyphs_.find(c);
if (it == p->glyphs_.end())
{
BOOST_LOG_TRIVIAL(info)
<< logPrefix_
<< "Character not found: " << static_cast<uint32_t>(c);
logger_->info("Character not found: {}", static_cast<uint32_t>(c));
continue;
}
@ -242,7 +240,7 @@ GLuint Font::GenerateTexture(gl::OpenGLFunctions& gl)
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;
boost::timer::cpu_timer timer;
@ -250,7 +248,7 @@ std::shared_ptr<Font> Font::Create(const std::string& resource)
auto it = fontMap_.find(resource);
if (it != fontMap_.end())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Font already created";
logger_->debug("Font already created");
return it->second;
}
@ -258,7 +256,7 @@ std::shared_ptr<Font> Font::Create(const std::string& resource)
fontFile.open(QIODevice::ReadOnly);
if (!fontFile.isOpen())
{
BOOST_LOG_TRIVIAL(error) << logPrefix_ << "Could not read font file";
logger_->error("Could not read font file");
return font;
}
@ -298,8 +296,7 @@ std::shared_ptr<Font> Font::Create(const std::string& resource)
}
}
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Font loaded in " << timer.format(6, "%ws");
logger_->debug("Font loaded in {}", timer.format(6, "%ws"));
texture_font_delete(textureFont);
@ -337,9 +334,8 @@ void FontImpl::ParseNames(FT_Face face)
}
}
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Font family: " << fontData_.fontFamily_ << " ("
<< fontData_.fontSubfamily_ << ")";
logger_->debug(
"Font family: {} ({})", fontData_.fontFamily_, fontData_.fontSubfamily_);
}
static void ParseSfntName(const FT_SfntName& sfntName, std::string& str)

View file

@ -1,9 +1,8 @@
#include <scwx/qt/util/font_buffer.hpp>
#include <scwx/util/logger.hpp>
#include <mutex>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -11,7 +10,8 @@ namespace qt
namespace util
{
static const std::string logPrefix_ = "[scwx::qt::util::font_buffer] ";
static const std::string logPrefix_ = "scwx::qt::util::font_buffer";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
class FontBufferImpl
{
@ -140,8 +140,7 @@ void FontBuffer::Push(std::initializer_list<GLuint> indices,
{
if (indices.size() % 3 != 0 || vertices.size() % 9 != 0)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid push arguments, ignoring";
logger_->warn("Invalid push arguments, ignoring");
return;
}

View file

@ -1,8 +1,8 @@
#include <scwx/qt/util/json.hpp>
#include <scwx/util/logger.hpp>
#include <fstream>
#include <boost/log/trivial.hpp>
#include <QFile>
#include <QTextStream>
@ -15,7 +15,8 @@ namespace util
namespace json
{
static const std::string logPrefix_ = "[scwx::qt::util::json] ";
static const std::string logPrefix_ = "scwx::qt::util::json";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
/* Adapted from:
* https://www.boost.org/doc/libs/1_77_0/libs/json/doc/html/json/examples.html#json.examples.pretty
@ -50,16 +51,18 @@ bool FromJsonInt64(const boost::json::object& json,
if (minValue.has_value() && value < *minValue)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << key << " less than minimum (" << value << " < "
<< *minValue << "), setting to: " << *minValue;
logger_->warn("{} less than minimum ({} < {}), setting to: {2}",
key,
value,
*minValue);
value = *minValue;
}
else if (maxValue.has_value() && value > *maxValue)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << key << " greater than maximum (" << value
<< " > " << *maxValue << "), setting to: " << *maxValue;
logger_->warn("{} greater than maximum ({} > {}), setting to: {2}",
key,
value,
*maxValue);
value = *maxValue;
}
else
@ -69,17 +72,17 @@ bool FromJsonInt64(const boost::json::object& json,
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << key << " is not an int64 (" << jv->kind()
<< "), setting to default:" << defaultValue;
logger_->warn("{} is not an int64 ({}), setting to default: {}",
key,
jv->kind(),
defaultValue);
value = defaultValue;
}
}
else
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << key
<< " is not present, setting to default: " << defaultValue;
logger_->debug(
"{} is not present, setting to default: {}", key, defaultValue);
value = defaultValue;
}
@ -103,17 +106,15 @@ bool FromJsonString(const boost::json::object& json,
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << key
<< " is not a string, setting to default: " << defaultValue;
logger_->warn(
"{} is not a string, setting to default: {}", key, defaultValue);
value = defaultValue;
}
}
else
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << key
<< " is not present, setting to default: " << defaultValue;
logger_->debug(
"{} is not present, setting to default: {}", key, defaultValue);
value = defaultValue;
}
@ -156,9 +157,8 @@ static boost::json::value ReadJsonFile(QFile& file)
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not open file for reading: \""
<< file.fileName().toStdString() << "\"";
logger_->warn("Could not open file for reading: \"{}\"",
file.fileName().toStdString());
}
return json;
@ -176,7 +176,7 @@ static boost::json::value ReadJsonStream(std::istream& is)
p.write(line, ec);
if (ec)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << ec.message();
logger_->warn("{}", ec.message());
return nullptr;
}
}
@ -184,7 +184,7 @@ static boost::json::value ReadJsonStream(std::istream& is)
p.finish(ec);
if (ec)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << ec.message();
logger_->warn("{}", ec.message());
return nullptr;
}
@ -199,8 +199,7 @@ void WriteJsonFile(const std::string& path,
if (!ofs.is_open())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Cannot write JSON file: \"" << path << "\"";
logger_->warn("Cannot write JSON file: \"{}\"", path);
}
else
{
@ -277,11 +276,17 @@ static void PrettyPrintJson(std::ostream& os,
break;
}
case boost::json::kind::uint64: os << jv.get_uint64(); break;
case boost::json::kind::uint64:
os << jv.get_uint64();
break;
case boost::json::kind::int64: os << jv.get_int64(); break;
case boost::json::kind::int64:
os << jv.get_int64();
break;
case boost::json::kind::double_: os << jv.get_double(); break;
case boost::json::kind::double_:
os << jv.get_double();
break;
case boost::json::kind::bool_:
if (jv.get_bool())
@ -290,7 +295,9 @@ static void PrettyPrintJson(std::ostream& os,
os << "false";
break;
case boost::json::kind::null: os << "null"; break;
case boost::json::kind::null:
os << "null";
break;
}
if (indent->empty())

View file

@ -1,9 +1,9 @@
#include <scwx/qt/view/level2_product_view.hpp>
#include <scwx/common/constants.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/threads.hpp>
#include <scwx/util/time.hpp>
#include <boost/log/trivial.hpp>
#include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp>
@ -14,7 +14,8 @@ namespace qt
namespace view
{
static const std::string logPrefix_ = "[scwx::qt::view::level2_product_view] ";
static const std::string logPrefix_ = "scwx::qt::view::level2_product_view";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static constexpr uint16_t RANGE_FOLDED = 1u;
static constexpr uint32_t VERTICES_PER_BIN = 6u;
@ -73,8 +74,8 @@ public:
}
else
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Unknown product: \""
<< common::GetLevel2Name(product) << "\"";
logger_->warn("Unknown product: \"{}\"",
common::GetLevel2Name(product));
dataBlockType_ = wsr88d::rda::DataBlockType::Unknown;
}
}
@ -347,7 +348,7 @@ void Level2ProductView::UpdateColorTable()
void Level2ProductView::ComputeSweep()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()";
logger_->debug("ComputeSweep()");
boost::timer::cpu_timer timer;
@ -382,8 +383,8 @@ void Level2ProductView::ComputeSweep()
if (momentData0 == nullptr)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "No moment data for "
<< common::GetLevel2Name(p->product_);
logger_->warn("No moment data for {}",
common::GetLevel2Name(p->product_));
return;
}
@ -462,8 +463,7 @@ void Level2ProductView::ComputeSweep()
if (momentData0->data_word_size() != momentData->data_word_size())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Radial " << radial << " has different word size";
logger_->warn("Radial {} has different word size", radial);
continue;
}
@ -632,8 +632,7 @@ void Level2ProductView::ComputeSweep()
}
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws");
logger_->debug("Vertices calculated in {}", timer.format(6, "%ws"));
UpdateColorTable();

View file

@ -6,7 +6,6 @@
#include <scwx/wsr88d/rpg/graphic_product_message.hpp>
#include <scwx/wsr88d/rpg/radial_data_packet.hpp>
#include <boost/log/trivial.hpp>
#include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp>
@ -17,7 +16,7 @@ namespace qt
namespace view
{
static const std::string logPrefix_ = "[scwx::qt::view::level3_product_view] ";
static const std::string logPrefix_ = "scwx::qt::view::level3_product_view";
static constexpr uint16_t RANGE_FOLDED = 1u;

View file

@ -1,11 +1,11 @@
#include <scwx/qt/view/level3_radial_view.hpp>
#include <scwx/common/constants.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/threads.hpp>
#include <scwx/util/time.hpp>
#include <scwx/wsr88d/rpg/digital_radial_data_array_packet.hpp>
#include <scwx/wsr88d/rpg/radial_data_packet.hpp>
#include <boost/log/trivial.hpp>
#include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp>
@ -16,7 +16,8 @@ namespace qt
namespace view
{
static const std::string logPrefix_ = "[scwx::qt::view::level3_radial_view] ";
static const std::string logPrefix_ = "scwx::qt::view::level3_radial_view";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static constexpr uint16_t RANGE_FOLDED = 1u;
static constexpr uint32_t VERTICES_PER_BIN = 6u;
@ -105,7 +106,7 @@ void Level3RadialView::SelectTime(std::chrono::system_clock::time_point time)
void Level3RadialView::ComputeSweep()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()";
logger_->debug("ComputeSweep()");
boost::timer::cpu_timer timer;
@ -120,8 +121,7 @@ void Level3RadialView::ComputeSweep()
std::dynamic_pointer_cast<wsr88d::rpg::GraphicProductMessage>(message);
if (gpm == nullptr)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Graphic Product Message not found";
logger_->warn("Graphic Product Message not found");
return;
}
else if (gpm == graphic_product_message())
@ -139,7 +139,7 @@ void Level3RadialView::ComputeSweep()
gpm->symbology_block();
if (descriptionBlock == nullptr || symbologyBlock == nullptr)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Missing blocks";
logger_->warn("Missing blocks");
return;
}
@ -147,8 +147,7 @@ void Level3RadialView::ComputeSweep()
uint16_t numberOfLayers = symbologyBlock->number_of_layers();
if (numberOfLayers < 1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "No layers present in symbology block";
logger_->warn("No layers present in symbology block");
return;
}
@ -199,7 +198,7 @@ void Level3RadialView::ComputeSweep()
}
else
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No radial data found";
logger_->debug("No radial data found");
return;
}
@ -207,8 +206,7 @@ void Level3RadialView::ComputeSweep()
const size_t radials = radialData->number_of_radials();
if (radials != 360 && radials != 720)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Unsupported number of radials: " << radials;
logger_->warn("Unsupported number of radials: {}", radials);
return;
}
@ -223,8 +221,7 @@ void Level3RadialView::ComputeSweep()
const uint16_t gates = radialData->number_of_range_bins();
if (gates < 1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "No range bins in radial data";
logger_->warn("No range bins in radial data");
return;
}
@ -368,8 +365,7 @@ void Level3RadialView::ComputeSweep()
dataMoments8.shrink_to_fit();
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws");
logger_->debug("Vertices calculated in {}", timer.format(6, "%ws"));
UpdateColorTable();

View file

@ -1,10 +1,10 @@
#include <scwx/qt/view/level3_raster_view.hpp>
#include <scwx/common/constants.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/threads.hpp>
#include <scwx/util/time.hpp>
#include <scwx/wsr88d/rpg/raster_data_packet.hpp>
#include <boost/log/trivial.hpp>
#include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp>
#include <GeographicLib/Geodesic.hpp>
@ -16,7 +16,8 @@ namespace qt
namespace view
{
static const std::string logPrefix_ = "[scwx::qt::view::level3_raster_view] ";
static const std::string logPrefix_ = "scwx::qt::view::level3_raster_view";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static constexpr uint16_t RANGE_FOLDED = 1u;
static constexpr uint32_t VERTICES_PER_BIN = 6u;
@ -105,7 +106,7 @@ void Level3RasterView::SelectTime(std::chrono::system_clock::time_point time)
void Level3RasterView::ComputeSweep()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()";
logger_->debug("ComputeSweep()");
boost::timer::cpu_timer timer;
@ -120,8 +121,7 @@ void Level3RasterView::ComputeSweep()
std::dynamic_pointer_cast<wsr88d::rpg::GraphicProductMessage>(message);
if (gpm == nullptr)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Graphic Product Message not found";
logger_->warn("Graphic Product Message not found");
return;
}
else if (gpm == graphic_product_message())
@ -139,7 +139,7 @@ void Level3RasterView::ComputeSweep()
gpm->symbology_block();
if (descriptionBlock == nullptr || symbologyBlock == nullptr)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Missing blocks";
logger_->warn("Missing blocks");
return;
}
@ -147,8 +147,7 @@ void Level3RasterView::ComputeSweep()
uint16_t numberOfLayers = symbologyBlock->number_of_layers();
if (numberOfLayers < 1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "No layers present in symbology block";
logger_->warn("No layers present in symbology block");
return;
}
@ -179,7 +178,7 @@ void Level3RasterView::ComputeSweep()
if (rasterData == nullptr)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No raster data found";
logger_->debug("No raster data found");
return;
}
@ -193,7 +192,7 @@ void Level3RasterView::ComputeSweep()
if (maxColumns == 0)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "No raster bins found";
logger_->debug("No raster bins found");
return;
}
@ -256,8 +255,7 @@ void Level3RasterView::ComputeSweep()
});
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Coordinates calculated in " << timer.format(6, "%ws");
logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws"));
// Calculate vertices
timer.start();
@ -332,8 +330,7 @@ void Level3RasterView::ComputeSweep()
dataMoments8.shrink_to_fit();
timer.stop();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws");
logger_->debug("Vertices calculated in {}", timer.format(6, "%ws"));
UpdateColorTable();

View file

@ -1,7 +1,7 @@
#include <scwx/qt/view/radar_product_view.hpp>
#include <scwx/common/constants.hpp>
#include <scwx/util/logger.hpp>
#include <boost/log/trivial.hpp>
#include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp>
@ -12,7 +12,8 @@ namespace qt
namespace view
{
static const std::string logPrefix_ = "[scwx::qt::view::radar_product_view] ";
static const std::string logPrefix_ = "scwx::qt::view::radar_product_view";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static const std::vector<boost::gil::rgba8_pixel_t> DEFAULT_COLOR_TABLE = {
boost::gil::rgba8_pixel_t(0, 128, 0, 255),
@ -102,7 +103,7 @@ RadarProductView::GetCfpMomentData() const
void RadarProductView::ComputeSweep()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()";
logger_->debug("ComputeSweep()");
emit SweepComputed();
}

View file

@ -2,11 +2,10 @@
#include <scwx/qt/view/level2_product_view.hpp>
#include <scwx/qt/view/level3_radial_view.hpp>
#include <scwx/qt/view/level3_raster_view.hpp>
#include <scwx/util/logger.hpp>
#include <unordered_set>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace qt
@ -15,7 +14,8 @@ namespace view
{
static const std::string logPrefix_ =
"[scwx::qt::view::radar_product_view_factory] ";
"scwx::qt::view::radar_product_view_factory";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
typedef std::function<std::shared_ptr<RadarProductView>(
const std::string& productName,
@ -46,8 +46,7 @@ std::shared_ptr<RadarProductView> RadarProductViewFactory::Create(
if (product == common::Level2Product::Unknown)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Unknown Level 2 radar product: " << productName;
logger_->warn("Unknown Level 2 radar product: {}", productName);
}
else
{
@ -67,9 +66,8 @@ std::shared_ptr<RadarProductView> RadarProductViewFactory::Create(
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Unknown radar product group: "
<< common::GetRadarProductGroupName(productGroup);
logger_->warn("Unknown radar product group: {}",
common::GetRadarProductGroupName(productGroup));
}
return view;

View file

@ -102,7 +102,7 @@
<context>
<name>scwx::qt::main::MainWindow</name>
<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>
<translation type="unfinished"></translation>
</message>

View file

@ -2,14 +2,12 @@
#include <gtest/gtest.h>
#include <boost/log/trivial.hpp>
namespace scwx
{
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)
{

View file

@ -2,15 +2,13 @@
#include <gtest/gtest.h>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace awips
{
static const std::string logPrefix_ =
"[scwx::awips::coded_time_motion_location.test] ";
"scwx::awips::coded_time_motion_location.test";
TEST(CodedTimeMotionLocation, LeadingZeroes)
{

View file

@ -2,14 +2,12 @@
#include <gtest/gtest.h>
#include <boost/log/trivial.hpp>
namespace scwx
{
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::chrono::hh_mm_ss<std::chrono::minutes>>

View file

@ -2,14 +2,12 @@
#include <gtest/gtest.h>
#include <boost/log/trivial.hpp>
namespace scwx
{
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>
{

View file

@ -4,15 +4,12 @@
#include <gtest/gtest.h>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
{
static const std::string logPrefix_ =
"[scwx::wsr88d::nexrad_file_factory.test] ";
static const std::string logPrefix_ = "scwx::wsr88d::nexrad_file_factory.test";
TEST(NexradFileFactory, Level2V06)
{

View file

@ -1,12 +1,12 @@
#include <gtest/gtest.h>
#include <scwx/util/logger.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/trivial.hpp>
#include <gtest/gtest.h>
#include <spdlog/spdlog.h>
int main(int argc, char** argv)
{
boost::log::core::get()->set_filter(boost::log::trivial::severity >=
boost::log::trivial::debug);
scwx::util::Logger::Initialize();
spdlog::set_level(spdlog::level::debug);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();

View file

@ -54,11 +54,6 @@ endif()
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)
target_link_libraries(wxtest GTest::gtest

View 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

View file

@ -1,15 +1,15 @@
#include <scwx/awips/coded_location.hpp>
#include <scwx/util/logger.hpp>
#include <sstream>
#include <boost/log/trivial.hpp>
namespace scwx
{
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
{
@ -93,9 +93,8 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo)
}
catch (const std::exception& ex)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid WFO location token: \"" << *token
<< "\" (" << ex.what() << ")";
logger_->warn(
"Invalid WFO location token: \"{}\" ({})", *token, ex.what());
dataValid = false;
break;
}
@ -128,10 +127,8 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo)
{
if (token->size() != 8)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid National Center LAT...LON format: \"" << *token
<< "\"";
logger_->warn("Invalid National Center LAT...LON format: \"{}\"",
*token);
dataValid = false;
break;
@ -147,9 +144,10 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo)
}
catch (const std::exception& ex)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid National Center location token: \""
<< *token << "\" (" << ex.what() << ")";
logger_->warn(
"Invalid National Center location token: \"{}\" ({})",
*token,
ex.what());
dataValid = false;
break;
}
@ -174,18 +172,17 @@ bool CodedLocation::Parse(const StringRange& lines, const std::string& wfo)
{
if (tokenList.empty())
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "LAT...LON not found";
logger_->warn("LAT...LON not found");
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Malformed LAT...LON tokens: (0: " << tokenList.at(0)
<< ", size: " << tokenList.size() << ")";
logger_->warn("Malformed LAT...LON tokens: (0: {}, size: {})",
tokenList.at(0),
tokenList.size());
for (const auto& token : tokenList)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << token;
logger_->debug("{}", token);
}
}

View file

@ -4,18 +4,17 @@
#endif
#include <scwx/awips/coded_time_motion_location.hpp>
#include <scwx/util/logger.hpp>
#include <sstream>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace awips
{
static const std::string logPrefix_ =
"[scwx::awips::coded_time_motion_location] ";
static const std::string logPrefix_ = "scwx::awips::coded_time_motion_location";
static const auto logger_ = util::Logger::Create(logPrefix_);
class CodedTimeMotionLocationImpl
{
@ -111,8 +110,7 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines,
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid time: \"" << time << "\"";
logger_->warn("Invalid time: \"{}\"", time);
p->time_ = hh_mm_ss<minutes> {};
dataValid = false;
}
@ -129,16 +127,14 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines,
}
catch (const std::exception& ex)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid direction: \"" << direction << "\" ("
<< ex.what() << ")";
logger_->warn(
"Invalid direction: \"{}\" ({})", direction, ex.what());
dataValid = false;
}
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid direction: \"" << direction << "\"";
logger_->warn("Invalid direction: \"{}\"", direction);
dataValid = false;
}
@ -153,15 +149,13 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines,
}
catch (const std::exception& ex)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Invalid speed: \""
<< speed << "\" (" << ex.what() << ")";
logger_->warn("Invalid speed: \"{}\" ({})", speed, ex.what());
dataValid = false;
}
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid speed: \"" << speed << "\"";
logger_->warn("Invalid speed: \"{}\"", speed);
dataValid = false;
}
@ -180,9 +174,8 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines,
}
catch (const std::exception& ex)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid location token: \"" << *token << "\" ("
<< ex.what() << ")";
logger_->warn(
"Invalid location token: \"{}\" ({})", *token, ex.what());
dataValid = false;
break;
}
@ -212,19 +205,17 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines,
{
if (tokenList.empty())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "TIME...MOT...LOC not found";
logger_->warn("TIME...MOT...LOC not found");
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Malformed TIME...MOT...LOC tokens: (0: " << tokenList.at(0)
<< ", size: " << tokenList.size() << ")";
logger_->warn("Malformed TIME...MOT...LOC tokens: (0: {}, size: {})",
tokenList.at(0),
tokenList.size());
for (const auto& token : tokenList)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << token;
logger_->debug("{}", token);
}
}

View file

@ -1,13 +1,13 @@
#include <scwx/awips/message.hpp>
#include <boost/log/trivial.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
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
{
@ -30,13 +30,12 @@ bool Message::ValidateMessage(std::istream& is, size_t bytesRead) const
if (is.eof())
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Reached end of data stream";
logger_->warn("Reached end of data stream");
messageValid = false;
}
else if (is.fail())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not read from input stream";
logger_->warn("Could not read from input stream");
messageValid = false;
}
else if (bytesRead != dataSize)
@ -47,15 +46,15 @@ bool Message::ValidateMessage(std::istream& is, size_t bytesRead) const
if (bytesRead < dataSize)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Message contents smaller than size: " << bytesRead
<< " < " << dataSize << " bytes";
logger_->trace("Message contents smaller than size: {} < {} bytes",
bytesRead,
dataSize);
}
if (bytesRead > dataSize)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Message contents larger than size: " << bytesRead
<< " > " << dataSize << " bytes";
logger_->warn("Message contents larger than size: {} > {} bytes",
bytesRead,
dataSize);
messageValid = false;
}
}

View file

@ -1,16 +1,17 @@
#include <scwx/awips/phenomenon.hpp>
#include <scwx/util/logger.hpp>
#include <boost/assign.hpp>
#include <boost/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
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>,
boost::bimaps::unordered_set_of<std::string>>
@ -147,8 +148,7 @@ Phenomenon GetPhenomenon(const std::string& code)
{
phenomenon = Phenomenon::Unknown;
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Unrecognized code: \"" << code << "\"";
logger_->debug("Unrecognized code: \"{}\"", code);
}
return phenomenon;

View file

@ -4,20 +4,21 @@
#endif
#include <scwx/awips/pvtec.hpp>
#include <scwx/util/logger.hpp>
#include <chrono>
#include <boost/assign.hpp>
#include <boost/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
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>,
boost::bimaps::unordered_set_of<std::string>>
@ -171,9 +172,9 @@ bool PVtec::Parse(const std::string& s)
}
catch (const std::exception& ex)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Error parsing event tracking number: \""
<< eventNumberString << "\" (" << ex.what() << ")";
logger_->warn("Error parsing event tracking number: \"{}\" ({})",
eventNumberString,
ex.what());
p->eventTrackingNumber_ = -1;
}
@ -214,8 +215,7 @@ bool PVtec::Parse(const std::string& s)
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid P-VTEC: \"" << s << "\"";
logger_->warn("Invalid P-VTEC: \"{}\"", s);
}
p->valid_ = dataValid;
@ -235,8 +235,7 @@ PVtec::ProductType PVtec::GetProductType(const std::string& code)
{
productType = ProductType::Unknown;
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Unrecognized product code: \"" << code << "\"";
logger_->debug("Unrecognized product code: \"{}\"", code);
}
return productType;
@ -259,8 +258,7 @@ PVtec::Action PVtec::GetAction(const std::string& code)
{
action = Action::Unknown;
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Unrecognized action code: \"" << code << "\"";
logger_->debug("Unrecognized action code: \"{}\"", code);
}
return action;

View file

@ -1,16 +1,17 @@
#include <scwx/awips/significance.hpp>
#include <scwx/util/logger.hpp>
#include <boost/assign.hpp>
#include <boost/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
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>,
boost::bimaps::unordered_set_of<std::string>>
@ -49,8 +50,7 @@ Significance GetSignificance(const std::string& code)
{
significance = Significance::Unknown;
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Unrecognized code: \"" << code << "\"";
logger_->debug("Unrecognized code: \"{}\"", code);
}
return significance;

View file

@ -1,15 +1,15 @@
#include <scwx/awips/text_product_file.hpp>
#include <scwx/util/logger.hpp>
#include <fstream>
#include <boost/log/trivial.hpp>
namespace scwx
{
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
{
@ -41,14 +41,13 @@ std::shared_ptr<TextProductMessage> TextProductFile::message(size_t i) const
bool TextProductFile::LoadFile(const std::string& filename)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")";
logger_->debug("LoadFile: {}", filename);
bool fileValid = true;
std::ifstream f(filename, std::ios_base::in | std::ios_base::binary);
if (!f.good())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not open file for reading: " << filename;
logger_->warn("Could not open file for reading: {}", filename);
fileValid = false;
}
@ -62,7 +61,7 @@ bool TextProductFile::LoadFile(const std::string& filename)
bool TextProductFile::LoadData(std::istream& is)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Data";
logger_->debug("Loading Data");
while (!is.eof())
{

View file

@ -9,14 +9,12 @@
#include <regex>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
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:
// * <hhmm>_xM_<tz>_day_mon_<dd>_year

View file

@ -1,12 +1,11 @@
#include <scwx/awips/wmo_header.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/streams.hpp>
#include <istream>
#include <sstream>
#include <string>
#include <boost/log/trivial.hpp>
#ifdef WIN32
# include <WinSock2.h>
#else
@ -18,7 +17,8 @@ namespace scwx
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
{
@ -139,7 +139,7 @@ bool WmoHeader::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
headerValid = false;
}
else
@ -176,29 +176,28 @@ bool WmoHeader::Parse(std::istream& is)
if (wmoTokenList.size() < 3 || wmoTokenList.size() > 4)
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Invalid number of WMO tokens";
logger_->debug("Invalid number of WMO tokens");
headerValid = false;
}
else if (wmoTokenList[0].size() != 6)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "WMO identifier malformed";
logger_->debug("WMO identifier malformed");
headerValid = false;
}
else if (wmoTokenList[1].size() != 4)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ICAO malformed";
logger_->debug("ICAO malformed");
headerValid = false;
}
else if (wmoTokenList[2].size() != 6)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Date/time malformed";
logger_->debug("Date/time malformed");
headerValid = false;
}
else if (wmoTokenList.size() == 4 && wmoTokenList[3].size() != 3)
{
// BBB indicator is optional
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "BBB indicator malformed";
logger_->debug("BBB indicator malformed");
headerValid = false;
}
else
@ -227,8 +226,7 @@ bool WmoHeader::Parse(std::istream& is)
{
if (awipsLine.size() != 6)
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "AWIPS Identifier Line bad size";
logger_->debug("AWIPS Identifier Line bad size");
headerValid = false;
}
else

View file

@ -1,4 +1,5 @@
#include <scwx/common/color_table.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/streams.hpp>
#include <cmath>
@ -9,7 +10,6 @@
#include <sstream>
#include <boost/gil.hpp>
#include <boost/log/trivial.hpp>
#include <hsluv.h>
@ -18,7 +18,8 @@ namespace scwx
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
{
@ -135,8 +136,7 @@ bool ColorTable::IsValid() const
std::shared_ptr<ColorTable> ColorTable::Load(const std::string& filename)
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Loading color table: " << filename;
logger_->debug("Loading color table: {}", filename);
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&)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not parse line: " << line;
logger_->warn("Could not parse line: {}", line);
}
}
}

View 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

View file

@ -1,6 +1,7 @@
#include <scwx/wsr88d/ar2v_file.hpp>
#include <scwx/wsr88d/rda/level2_message_factory.hpp>
#include <scwx/wsr88d/rda/types.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/rangebuf.hpp>
#include <scwx/util/time.hpp>
@ -10,14 +11,14 @@
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
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
{
@ -115,8 +116,7 @@ Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
float elevation,
std::chrono::system_clock::time_point time) const
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "GetElevationScan: " << elevation << " degrees";
logger_->debug("GetElevationScan: {} degrees", elevation);
constexpr float scaleFactor = 8.0f / 0.043945f;
@ -170,14 +170,13 @@ Ar2vFile::GetElevationScan(rda::DataBlockType dataBlockType,
bool Ar2vFile::LoadFile(const std::string& filename)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")";
logger_->debug("LoadFile: {}", filename);
bool fileValid = true;
std::ifstream f(filename, std::ios_base::in | std::ios_base::binary);
if (!f.good())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not open file for reading: " << filename;
logger_->warn("Could not open file for reading: {}", filename);
fileValid = false;
}
@ -191,7 +190,7 @@ bool Ar2vFile::LoadFile(const std::string& filename)
bool Ar2vFile::LoadData(std::istream& is)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Data";
logger_->debug("Loading Data");
bool dataValid = true;
@ -211,21 +210,17 @@ bool Ar2vFile::LoadData(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not read Volume Header Record\n";
logger_->warn("Could not read Volume Header Record");
dataValid = false;
}
if (dataValid)
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Filename: " << p->tapeFilename_;
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Extension: " << p->extensionNumber_;
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Date: " << p->julianDate_;
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Time: " << p->milliseconds_;
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ICAO: " << p->icao_;
logger_->debug("Filename: {}", p->tapeFilename_);
logger_->debug("Extension: {}", p->extensionNumber_);
logger_->debug("Date: {}", p->julianDate_);
logger_->debug("Time: {}", p->milliseconds_);
logger_->debug("ICAO: {}", p->icao_);
size_t decompressedRecords = p->DecompressLDMRecords(is);
if (decompressedRecords == 0)
@ -245,7 +240,7 @@ bool Ar2vFile::LoadData(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;
@ -260,8 +255,7 @@ size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is)
controlWord = ntohl(controlWord);
recordSize = std::abs(controlWord);
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "LDM Record Found: Size = " << recordSize << " bytes";
logger_->trace("LDM Record Found: Size = {} bytes", recordSize);
if (recordSize == 0)
{
@ -278,17 +272,14 @@ size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is)
{
std::stringstream ss;
std::streamsize bytesCopied = boost::iostreams::copy(in, ss);
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Decompressed record size = " << bytesCopied
<< " bytes";
logger_->trace("Decompressed record size = {} bytes", bytesCopied);
rawRecords_.push_back(std::move(ss));
}
catch (const boost::iostreams::bzip2_error& ex)
{
int error = ex.error();
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Error decompressing record " << numRecords;
logger_->warn("Error decompressing record {}", numRecords);
is.seekg(startPosition + std::streampos(recordSize),
std::ios_base::beg);
@ -297,15 +288,14 @@ size_t Ar2vFileImpl::DecompressLDMRecords(std::istream& is)
++numRecords;
}
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Decompressed " << numRecords << " LDM Records";
logger_->debug("Decompressed {} LDM Records", numRecords);
return numRecords;
}
void Ar2vFileImpl::ParseLDMRecords()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Parsing LDM Records";
logger_->debug("Parsing LDM Records");
size_t count = 0;
@ -313,7 +303,7 @@ void Ar2vFileImpl::ParseLDMRecords()
{
std::stringstream& ss = *it;
BOOST_LOG_TRIVIAL(trace) << logPrefix_ << "Record " << count++;
logger_->trace("Record {}", count++);
ParseLDMRecord(ss);
}
@ -346,8 +336,7 @@ void Ar2vFileImpl::ParseLDMRecord(std::istream& is)
if (!is.eof() && offset != 0)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Next record offset by " << offset << " bytes";
logger_->trace("Next record offset by {} bytes", offset);
}
else if (is.eof())
{
@ -382,7 +371,8 @@ void Ar2vFileImpl::HandleMessage(std::shared_ptr<rda::Level2Message>& message)
std::static_pointer_cast<rda::DigitalRadarData>(message));
break;
default: break;
default:
break;
}
}
@ -402,12 +392,11 @@ void Ar2vFileImpl::ProcessRadarData(
void Ar2vFileImpl::IndexFile()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Indexing file";
logger_->debug("Indexing file");
if (vcpData_ == nullptr)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Cannot index file without VCP data";
logger_->warn("Cannot index file without VCP data");
return;
}

View file

@ -1,20 +1,21 @@
#include <scwx/wsr88d/level3_file.hpp>
#include <scwx/wsr88d/rpg/ccb_header.hpp>
#include <scwx/wsr88d/rpg/level3_message_factory.hpp>
#include <scwx/util/logger.hpp>
#include <fstream>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filter/zlib.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
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
{
@ -50,14 +51,13 @@ std::shared_ptr<rpg::Level3Message> Level3File::message() const
bool Level3File::LoadFile(const std::string& filename)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "LoadFile(" << filename << ")";
logger_->debug("LoadFile: {}", filename);
bool fileValid = true;
std::ifstream f(filename, std::ios_base::in | std::ios_base::binary);
if (!f.good())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not open file for reading: " << filename;
logger_->warn("Could not open file for reading: {}", filename);
fileValid = false;
}
@ -71,7 +71,7 @@ bool Level3File::LoadFile(const std::string& filename)
bool Level3File::LoadData(std::istream& is)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Data";
logger_->debug("Loading Data");
p->wmoHeader_ = std::make_shared<awips::WmoHeader>();
@ -79,16 +79,11 @@ bool Level3File::LoadData(std::istream& is)
if (dataValid)
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Data Type: " << p->wmoHeader_->data_type();
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "ICAO: " << p->wmoHeader_->icao();
BOOST_LOG_TRIVIAL(debug)
<< 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();
logger_->debug("Data Type: {}", p->wmoHeader_->data_type());
logger_->debug("ICAO: {}", p->wmoHeader_->icao());
logger_->debug("Date/Time: {}", p->wmoHeader_->date_time());
logger_->debug("Category: {}", p->wmoHeader_->product_category());
logger_->debug("Site ID: {}", p->wmoHeader_->product_designator());
// If the header is compressed
if (is.peek() == 0x78)
@ -146,20 +141,15 @@ bool Level3FileImpl::DecompressFile(std::istream& is, std::stringstream& ss)
{
int error = ex.error();
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Error decompressing data: " << ex.what();
logger_->warn("Error decompressing data: {}", ex.what());
dataValid = false;
}
if (dataValid)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Input data consumed = " << totalBytesCopied
<< " bytes";
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Decompressed data size = " << totalBytesConsumed
<< " bytes";
logger_->trace("Input data consumed = {} bytes", totalBytesCopied);
logger_->trace("Decompressed data size = {} bytes", totalBytesConsumed);
ccbHeader_ = std::make_shared<rpg::CcbHeader>();
dataValid = ccbHeader_->Parse(ss);

View file

@ -1,6 +1,7 @@
#include <scwx/wsr88d/nexrad_file_factory.hpp>
#include <scwx/wsr88d/ar2v_file.hpp>
#include <scwx/wsr88d/level3_file.hpp>
#include <scwx/util/logger.hpp>
#include <fstream>
#include <sstream>
@ -8,19 +9,19 @@
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
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>
NexradFileFactory::Create(const std::string& filename)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Create(" << filename << ")";
logger_->debug("Create: {}", filename);
std::shared_ptr<NexradFile> nexradFile = nullptr;
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);
if (!f.good())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Could not open file for reading: " << filename;
logger_->warn("Could not open file for reading: {}", filename);
fileValid = false;
}
@ -74,26 +74,23 @@ std::shared_ptr<NexradFile> NexradFileFactory::Create(std::istream& is)
dataValid = ss.good();
ss.seekg(pisBegin, std::ios_base::beg);
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Decompressed file = " << bytesCopied << " bytes";
logger_->trace("Decompressed file = {} bytes", bytesCopied);
if (!dataValid)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Error reading decompressed stream";
logger_->warn("Error reading decompressed stream");
}
}
catch (const boost::iostreams::gzip_error& ex)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Error decompressing file: " << ex.what();
logger_->warn("Error decompressing file: {}", ex.what());
dataValid = false;
}
}
else if (!dataValid)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Error reading file";
logger_->warn("Error reading file");
}
if (dataValid)

View file

@ -1,9 +1,8 @@
#include <scwx/wsr88d/rda/clutter_filter_bypass_map.hpp>
#include <scwx/util/logger.hpp>
#include <vector>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -12,7 +11,8 @@ namespace rda
{
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
{
@ -61,8 +61,7 @@ ClutterFilterBypassMap::range_bin(uint16_t e, uint16_t r, uint16_t b) const
bool ClutterFilterBypassMap::Parse(std::istream& is)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Parsing Clutter Filter Bypass Map (Message Type 13)";
logger_->trace("Parsing Clutter Filter Bypass Map (Message Type 13)");
bool messageValid = true;
size_t bytesRead = 0;
@ -79,21 +78,18 @@ bool ClutterFilterBypassMap::Parse(std::istream& is)
if (p->mapGenerationDate_ < 1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid date: " << p->mapGenerationDate_;
logger_->warn("Invalid date: {}", p->mapGenerationDate_);
messageValid = false;
}
if (p->mapGenerationTime_ > 1440)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid time: " << p->mapGenerationTime_;
logger_->warn("Invalid time: {}", p->mapGenerationTime_);
messageValid = false;
}
if (numElevationSegments < 1 || numElevationSegments > 5)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of elevation segments: " << numElevationSegments;
logger_->warn("Invalid number of elevation segments: {}",
numElevationSegments);
messageValid = false;
}

View file

@ -1,9 +1,8 @@
#include <scwx/wsr88d/rda/clutter_filter_map.hpp>
#include <scwx/util/logger.hpp>
#include <vector>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -11,8 +10,8 @@ namespace wsr88d
namespace rda
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rda::clutter_filter_map] ";
static const std::string logPrefix_ = "scwx::wsr88d::rda::clutter_filter_map";
static const auto logger_ = util::Logger::Create(logPrefix_);
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)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Parsing Clutter Filter Map (Message Type 15)";
logger_->trace("Parsing Clutter Filter Map (Message Type 15)");
bool messageValid = true;
size_t bytesRead = 0;
@ -93,21 +91,18 @@ bool ClutterFilterMap::Parse(std::istream& is)
if (p->mapGenerationDate_ < 1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid date: " << p->mapGenerationDate_;
logger_->warn("Invalid date: {}", p->mapGenerationDate_);
messageValid = false;
}
if (p->mapGenerationTime_ > 1440)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid time: " << p->mapGenerationTime_;
logger_->warn("Invalid time: {}", p->mapGenerationTime_);
messageValid = false;
}
if (numElevationSegments < 1 || numElevationSegments > 5)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of elevation segments: " << numElevationSegments;
logger_->warn("Invalid number of elevation segments: {}",
numElevationSegments);
messageValid = false;
}
@ -132,9 +127,7 @@ bool ClutterFilterMap::Parse(std::istream& is)
if (numRangeZones < 1 || numRangeZones > 20)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of range zones: " << numRangeZones;
logger_->warn("Invalid number of range zones: {}", numRangeZones);
messageValid = false;
}
@ -158,14 +151,12 @@ bool ClutterFilterMap::Parse(std::istream& is)
if (zone.opCode > 2)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid op code: " << zone.opCode;
logger_->warn("Invalid op code: {}", zone.opCode);
messageValid = false;
}
if (zone.endRange > 511)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid end range: " << zone.endRange;
logger_->warn("Invalid end range: {}", zone.endRange);
messageValid = false;
}
}

View file

@ -1,6 +1,5 @@
#include <scwx/wsr88d/rda/digital_radar_data.hpp>
#include <boost/log/trivial.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
@ -9,8 +8,8 @@ namespace wsr88d
namespace rda
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rda::digital_radar_data] ";
static const std::string logPrefix_ = "scwx::wsr88d::rda::digital_radar_data";
static const auto logger_ = util::Logger::Create(logPrefix_);
static const std::unordered_map<std::string, DataBlockType> strToDataBlock_ {
{"VOL", DataBlockType::Volume},
@ -145,9 +144,15 @@ const void* MomentDataBlock::data_moments() const
switch (p->dataWordSize_)
{
case 8: dataMoments = p->momentGates8_.data(); break;
case 16: dataMoments = p->momentGates16_.data(); break;
default: dataMoments = nullptr; break;
case 8:
dataMoments = p->momentGates8_.data();
break;
case 16:
dataMoments = p->momentGates16_.data();
break;
default:
dataMoments = nullptr;
break;
}
return dataMoments;
@ -210,16 +215,14 @@ bool MomentDataBlock::Parse(std::istream& is)
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid data word size: " << p->dataWordSize_;
logger_->warn("Invalid data word size: {}", p->dataWordSize_);
dataBlockValid = false;
}
}
else
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid number of data moment gates: "
<< p->numberOfDataMomentGates_;
logger_->warn("Invalid number of data moment gates: {}",
p->numberOfDataMomentGates_);
dataBlockValid = false;
}
@ -657,8 +660,7 @@ DigitalRadarData::moment_data_block(DataBlockType type) const
bool DigitalRadarData::Parse(std::istream& is)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Parsing Digital Radar Data (Message Type 31)";
logger_->trace("Parsing Digital Radar Data (Message Type 31)");
bool messageValid = true;
size_t bytesRead = 0;
@ -694,26 +696,22 @@ bool DigitalRadarData::Parse(std::istream& is)
if (p->azimuthNumber_ < 1 || p->azimuthNumber_ > 720)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid azimuth number: " << p->azimuthNumber_;
logger_->warn("Invalid azimuth number: {}", p->azimuthNumber_);
messageValid = false;
}
if (p->elevationNumber_ < 1 || p->elevationNumber_ > 32)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid elevation number: " << p->elevationNumber_;
logger_->warn("Invalid elevation number: ", p->elevationNumber_);
messageValid = false;
}
if (p->dataBlockCount_ < 4 || p->dataBlockCount_ > 10)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of data blocks: " << p->dataBlockCount_;
logger_->warn("Invalid number of data blocks: {}", p->dataBlockCount_);
messageValid = false;
}
if (p->compressionIndicator_ != 0)
{
BOOST_LOG_TRIVIAL(warning) << logPrefix_ << "Compression not supported";
logger_->warn("Compression not supported");
messageValid = false;
}
@ -772,8 +770,7 @@ bool DigitalRadarData::Parse(std::istream& is)
std::move(MomentDataBlock::Create(dataBlockType, dataName, is));
break;
default:
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Unknown data name: " << dataName;
logger_->warn("Unknown data name: {}", dataName);
break;
}
}

View file

@ -1,7 +1,5 @@
#include <scwx/wsr88d/rda/level2_message.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -9,7 +7,7 @@ namespace wsr88d
namespace rda
{
static const std::string logPrefix_ = "[scwx::wsr88d::rda::level2_message] ";
static const std::string logPrefix_ = "scwx::wsr88d::rda::level2_message";
class Level2MessageImpl
{

View file

@ -1,5 +1,6 @@
#include <scwx/wsr88d/rda/level2_message_factory.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/vectorbuf.hpp>
#include <scwx/wsr88d/rda/clutter_filter_bypass_map.hpp>
#include <scwx/wsr88d/rda/clutter_filter_map.hpp>
@ -12,8 +13,6 @@
#include <unordered_map>
#include <vector>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -22,7 +21,8 @@ namespace rda
{
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&&,
std::istream&)>
@ -51,9 +51,8 @@ Level2MessageInfo Level2MessageFactory::Create(std::istream& is)
if (info.headerValid && create_.find(header.message_type()) == create_.end())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Unknown message type: "
<< static_cast<unsigned>(header.message_type());
logger_->warn("Unknown message type: {}",
static_cast<unsigned>(header.message_type()));
info.messageValid = false;
}
@ -68,16 +67,15 @@ Level2MessageInfo Level2MessageFactory::Create(std::istream& is)
if (totalSegments == 1)
{
BOOST_LOG_TRIVIAL(trace) << logPrefix_ << "Found Message "
<< static_cast<unsigned>(messageType);
logger_->trace("Found Message {}", static_cast<unsigned>(messageType));
messageStream = &is;
}
else
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Found Message "
<< static_cast<unsigned>(messageType) << " Segment " << segment
<< "/" << totalSegments;
logger_->trace("Found Message {} Segment {}/{}",
static_cast<unsigned>(messageType),
segment,
totalSegments);
if (segment == 1)
{
@ -89,8 +87,7 @@ Level2MessageInfo Level2MessageFactory::Create(std::istream& is)
if (messageData_.capacity() < bufferedSize_ + dataSize)
{
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Bad size estimate, increasing size";
logger_->debug("Bad size estimate, increasing size");
// Estimate remaining size
uint16_t remainingSegments =
@ -105,8 +102,7 @@ Level2MessageInfo Level2MessageFactory::Create(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "End of file reached trying to buffer message";
logger_->warn("End of file reached trying to buffer message");
info.messageValid = false;
messageData_.shrink_to_fit();
bufferedSize_ = 0;

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rda/level2_message_header.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
#ifdef WIN32
# include <WinSock2.h>
#else
@ -19,7 +18,8 @@ namespace rda
{
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
{
@ -123,44 +123,40 @@ bool Level2MessageHeader::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
headerValid = false;
}
else
{
if (p->messageSize_ < 9)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid message size: " << p->messageSize_;
logger_->warn("Invalid message size: {}", p->messageSize_);
headerValid = false;
}
if (p->julianDate_ < 1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid date: " << p->julianDate_;
logger_->warn("Invalid date: {}", p->julianDate_);
headerValid = false;
}
if (p->millisecondsOfDay_ > 86'399'999u)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid milliseconds: " << p->millisecondsOfDay_;
logger_->warn("Invalid milliseconds: {}", p->millisecondsOfDay_);
headerValid = false;
}
if (p->messageSize_ < 65534 &&
p->messageSegmentNumber_ > p->numberOfMessageSegments_)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid segment = " << p->messageSegmentNumber_
<< "/" << p->numberOfMessageSegments_;
logger_->warn("Invalid segment = {}/{}",
p->messageSegmentNumber_,
p->numberOfMessageSegments_);
headerValid = false;
}
}
if (headerValid)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_
<< "Message type: " << static_cast<unsigned>(p->messageType_);
logger_->trace("Message type: {}",
static_cast<unsigned>(p->messageType_));
}
return headerValid;

View file

@ -1,9 +1,8 @@
#include <scwx/wsr88d/rda/performance_maintenance_data.hpp>
#include <scwx/util/logger.hpp>
#include <array>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -12,7 +11,8 @@ namespace rda
{
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
{
@ -1823,8 +1823,7 @@ uint16_t PerformanceMaintenanceData::version() const
bool PerformanceMaintenanceData::Parse(std::istream& is)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Parsing Performance/Maintenance Data (Message Type 3)";
logger_->trace("Parsing Performance/Maintenance Data (Message Type 3)");
bool messageValid = true;
size_t bytesRead = 0;

View file

@ -1,6 +1,5 @@
#include <scwx/wsr88d/rda/rda_adaptation_data.hpp>
#include <boost/log/trivial.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
@ -9,8 +8,8 @@ namespace wsr88d
namespace rda
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rda::rda_adaptation_data] ";
static const std::string logPrefix_ = "scwx::wsr88d::rda::rda_adaptation_data";
static const auto logger_ = util::Logger::Create(logPrefix_);
struct AntManualSetup
{
@ -1267,8 +1266,7 @@ float RdaAdaptationData::txb_alarm_thresh() const
bool RdaAdaptationData::Parse(std::istream& is)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Parsing RDA Adaptation Data (Message Type 18)";
logger_->trace("Parsing RDA Adaptation Data (Message Type 18)");
bool messageValid = true;
size_t bytesRead = 0;

View file

@ -1,6 +1,5 @@
#include <scwx/wsr88d/rda/rda_status_data.hpp>
#include <boost/log/trivial.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
@ -9,7 +8,8 @@ namespace wsr88d
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
{
@ -233,8 +233,7 @@ uint16_t RdaStatusData::status_version() const
bool RdaStatusData::Parse(std::istream& is)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Parsing RDA Status Data (Message Type 2)";
logger_->trace("Parsing RDA Status Data (Message Type 2)");
bool messageValid = true;
size_t bytesRead = 0;

View file

@ -1,6 +1,5 @@
#include <scwx/wsr88d/rda/volume_coverage_pattern_data.hpp>
#include <boost/log/trivial.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
@ -10,7 +9,8 @@ namespace rda
{
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;
@ -137,8 +137,12 @@ float VolumeCoveragePatternData::doppler_velocity_resolution() const
switch (p->dopplerVelocityResolution_)
{
case 2: resolution = 0.5f; break;
case 4: resolution = 1.0f; break;
case 2:
resolution = 0.5f;
break;
case 4:
resolution = 1.0f;
break;
}
return resolution;
@ -233,12 +237,18 @@ WaveformType VolumeCoveragePatternData::waveform_type(uint16_t e) const
{
switch (p->elevationCuts_[e].waveformType_)
{
case 1: return WaveformType::ContiguousSurveillance;
case 2: return WaveformType::ContiguousDopplerWithAmbiguityResolution;
case 3: return WaveformType::ContiguousDopplerWithoutAmbiguityResolution;
case 4: return WaveformType::Batch;
case 5: return WaveformType::StaggeredPulsePair;
default: return WaveformType::Unknown;
case 1:
return WaveformType::ContiguousSurveillance;
case 2:
return WaveformType::ContiguousDopplerWithAmbiguityResolution;
case 3:
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)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Parsing Volume Coverage Pattern Data (Message Type 5)";
logger_->trace("Parsing Volume Coverage Pattern Data (Message Type 5)");
bool messageValid = true;
size_t bytesRead = 0;
@ -412,15 +421,13 @@ bool VolumeCoveragePatternData::Parse(std::istream& is)
if (messageSize < 34 || messageSize > 747)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid message size: " << messageSize;
logger_->warn("Invalid message size: {}", messageSize);
messageValid = false;
}
if (numberOfElevationCuts < 1 || numberOfElevationCuts > 32)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of elevation cuts: " << numberOfElevationCuts;
logger_->warn("Invalid number of elevation cuts: {}",
numberOfElevationCuts);
messageValid = false;
}
@ -483,9 +490,9 @@ bool VolumeCoveragePatternData::Parse(std::istream& is)
if (messageValid && bytesRead != messageSize * 2)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Bytes read (" << bytesRead
<< ") not equal to message size (" << messageSize * 2 << ")";
logger_->warn("Bytes read ({}) not equal to message size ({})",
bytesRead,
messageSize * 2);
}
if (!ValidateMessage(is, bytesRead))

View file

@ -1,12 +1,11 @@
#include <scwx/wsr88d/rpg/ccb_header.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/streams.hpp>
#include <istream>
#include <sstream>
#include <string>
#include <boost/log/trivial.hpp>
#ifdef WIN32
# include <WinSock2.h>
#else
@ -20,7 +19,8 @@ namespace wsr88d
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
{
@ -197,7 +197,7 @@ bool CcbHeader::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
headerValid = false;
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/cell_trend_data_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -134,21 +134,19 @@ bool CellTrendDataPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 21)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
else if (p->lengthOfBlock_ < 12 || p->lengthOfBlock_ > 198)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid length of block: " << p->packetCode_;
logger_->warn("Invalid length of block: {}", p->packetCode_);
blockValid = false;
}
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/cell_trend_volume_scan_times.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -93,21 +93,19 @@ bool CellTrendVolumeScanTimes::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 22)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
else if (p->lengthOfBlock_ < 4 || p->lengthOfBlock_ > 22)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid length of block: " << p->packetCode_;
logger_->warn("Invalid length of block: {}", p->packetCode_);
blockValid = false;
}
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/digital_precipitation_data_array_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -97,21 +97,19 @@ bool DigitalPrecipitationDataArrayPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 17)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
if (p->numberOfRows_ != 131)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid number of rows: " << p->numberOfRows_;
logger_->warn("Invalid number of rows: {}", p->numberOfRows_);
blockValid = false;
}
}
@ -134,10 +132,9 @@ bool DigitalPrecipitationDataArrayPacket::Parse(std::istream& is)
if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 262 ||
row.numberOfBytes_ % 2 != 0)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of bytes in row: " << row.numberOfBytes_
<< " (Row " << r << ")";
logger_->warn("Invalid number of bytes in row: {} (Row {})",
row.numberOfBytes_,
r);
blockValid = false;
break;
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/digital_radial_data_array_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -148,36 +148,31 @@ bool DigitalRadialDataArrayPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 16)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
if (p->indexOfFirstRangeBin_ < 0 || p->indexOfFirstRangeBin_ > 230)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid index of first range bin: " << p->indexOfFirstRangeBin_;
logger_->warn("Invalid index of first range bin: {}",
p->indexOfFirstRangeBin_);
blockValid = false;
}
if (p->numberOfRangeBins_ < 0 || p->numberOfRangeBins_ > 1840)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of range bins: " << p->numberOfRangeBins_;
logger_->warn("Invalid number of range bins: {}",
p->numberOfRangeBins_);
blockValid = false;
}
if (p->numberOfRadials_ < 1 || p->numberOfRadials_ > 720)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of radials: " << p->numberOfRadials_;
logger_->warn("Invalid number of radials: {}", p->numberOfRadials_);
blockValid = false;
}
}
@ -201,19 +196,19 @@ bool DigitalRadialDataArrayPacket::Parse(std::istream& is)
if (radial.numberOfBytes_ < 1 || radial.numberOfBytes_ > 1840)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of bytes: " << radial.numberOfBytes_
<< " (Radial " << r << ")";
logger_->warn("Invalid number of bytes: {} (Radial {})",
radial.numberOfBytes_,
r);
blockValid = false;
break;
}
else if (radial.numberOfBytes_ < p->numberOfRangeBins_)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Number of bytes < number of range bins: "
<< radial.numberOfBytes_ << " < " << p->numberOfRangeBins_
<< " (Radial " << r << ")";
logger_->warn(
"Number of bytes < number of range bins: {} < {} (Radial {})",
radial.numberOfBytes_,
p->numberOfRangeBins_,
r);
blockValid = false;
break;
}

View file

@ -4,8 +4,6 @@
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -14,7 +12,7 @@ namespace rpg
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rpg::general_status_message] ";
"scwx::wsr88d::rpg::general_status_message";
class GeneralStatusMessageImpl
{

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/generic_data_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -12,8 +11,8 @@ namespace wsr88d
namespace rpg
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rpg::generic_data_packet] ";
static const std::string logPrefix_ = "scwx::wsr88d::rpg::generic_data_packet";
static const auto logger_ = util::Logger::Create(logPrefix_);
class GenericDataPacketImpl
{
@ -70,15 +69,14 @@ bool GenericDataPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 28 && p->packetCode_ != 29)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
}

View file

@ -2,8 +2,6 @@
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -12,7 +10,7 @@ namespace rpg
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rpg::generic_radial_data_packet] ";
"scwx::wsr88d::rpg::generic_radial_data_packet";
class GenericRadialDataPacketImpl
{

View file

@ -1,11 +1,10 @@
#include <scwx/wsr88d/rpg/graphic_alphanumeric_block.hpp>
#include <scwx/wsr88d/rpg/packet_factory.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -14,7 +13,8 @@ namespace rpg
{
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
{
@ -76,33 +76,29 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->blockDivider_ != -1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block divider: " << p->blockDivider_;
logger_->warn("Invalid block divider: {}", p->blockDivider_);
blockValid = false;
}
if (p->blockId_ != 2)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block ID: " << p->blockId_;
logger_->warn("Invalid block ID: {}", p->blockId_);
blockValid = false;
}
if (p->lengthOfBlock_ < 10)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block length: " << p->lengthOfBlock_;
logger_->warn("Invalid block length: {}", p->lengthOfBlock_);
blockValid = false;
}
if (p->numberOfPages_ < 1 || p->numberOfPages_ > 48)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid number of pages: " << p->numberOfPages_;
logger_->warn("Invalid number of pages: {}", p->numberOfPages_);
blockValid = false;
}
}
@ -114,7 +110,7 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is)
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;
uint32_t bytesRead = 0;
@ -131,9 +127,8 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is)
if (pageNumber != i + 1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Page out of order: Expected " << (i + 1)
<< ", found " << pageNumber;
logger_->warn(
"Page out of order: Expected {}, found {}", (i + 1), pageNumber);
}
while (bytesRead < lengthOfPage)
@ -152,19 +147,17 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is)
if (bytesRead < lengthOfPage)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_
<< "Page bytes read smaller than size: " << bytesRead << " < "
<< lengthOfPage << " bytes";
logger_->trace("Page bytes read smaller than size: {} < {} bytes",
bytesRead,
lengthOfPage);
blockValid = false;
is.seekg(pageEnd, std::ios_base::beg);
}
if (bytesRead > lengthOfPage)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Page bytes read larger than size: " << bytesRead << " > "
<< lengthOfPage << " bytes";
logger_->warn("Page bytes read larger than size: {} > {} bytes",
bytesRead,
lengthOfPage);
blockValid = false;
is.seekg(pageEnd, std::ios_base::beg);
}

View file

@ -1,4 +1,5 @@
#include <scwx/wsr88d/rpg/graphic_product_message.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/rangebuf.hpp>
#include <istream>
@ -7,7 +8,6 @@
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
@ -17,7 +17,8 @@ namespace rpg
{
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
{
@ -102,17 +103,14 @@ bool GraphicProductMessage::Parse(std::istream& is)
{
std::stringstream ss;
std::streamsize bytesCopied = boost::iostreams::copy(in, ss);
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Decompressed data size = " << bytesCopied
<< " bytes";
logger_->trace("Decompressed data size = {} bytes", bytesCopied);
dataValid = p->LoadBlocks(ss);
}
catch (const boost::iostreams::bzip2_error& ex)
{
int error = ex.error();
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Error decompressing data: " << ex.what();
logger_->warn("Error decompressing data: {}", ex.what());
dataValid = false;
}
@ -138,7 +136,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is)
bool graphicValid = true;
bool tabularValid = true;
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks";
logger_->debug("Loading Blocks");
std::streampos offsetBasePos = is.tellg();
@ -157,8 +155,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is)
symbologyValid = symbologyBlock_->Parse(is);
is.seekg(offsetBasePos, std::ios_base::beg);
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Product symbology block valid: " << symbologyValid;
logger_->debug("Product symbology block valid: {}", symbologyValid);
if (!symbologyValid)
{
@ -174,8 +171,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is)
graphicValid = graphicBlock_->Parse(is);
is.seekg(offsetBasePos, std::ios_base::beg);
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Graphic alphanumeric block valid: " << graphicValid;
logger_->debug("Graphic alphanumeric block valid: {}", graphicValid);
if (!graphicValid)
{
@ -191,8 +187,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is)
tabularValid = tabularBlock_->Parse(is);
is.seekg(offsetBasePos, std::ios_base::beg);
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Tabular alphanumeric block valid: " << tabularValid;
logger_->debug("Tabular alphanumeric block valid: {}", tabularValid);
if (!tabularValid)
{

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/hda_hail_symbol_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -90,8 +90,7 @@ bool HdaHailSymbolPacket::ParseData(std::istream& is)
if (packet_code() != 19)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << packet_code();
logger_->warn("Invalid packet code: {}", packet_code());
blockValid = false;
}

View file

@ -1,7 +1,5 @@
#include <scwx/wsr88d/rpg/level3_message.hpp>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -9,7 +7,7 @@ namespace wsr88d
namespace rpg
{
static const std::string logPrefix_ = "[scwx::wsr88d::rpg::level3_message] ";
static const std::string logPrefix_ = "scwx::wsr88d::rpg::level3_message";
class Level3MessageImpl
{

View file

@ -1,5 +1,6 @@
#include <scwx/wsr88d/rpg/level3_message_factory.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/vectorbuf.hpp>
#include <scwx/wsr88d/rpg/general_status_message.hpp>
#include <scwx/wsr88d/rpg/graphic_product_message.hpp>
@ -9,8 +10,6 @@
#include <unordered_map>
#include <vector>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -19,7 +18,8 @@ namespace rpg
{
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&&,
std::istream&)>
@ -133,8 +133,7 @@ std::shared_ptr<Level3Message> Level3MessageFactory::Create(std::istream& is)
if (headerValid && create_.find(header.message_code()) == create_.end())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Unknown message type: " << header.message_code();
logger_->warn("Unknown message type: {}", header.message_code());
messageValid = false;
}
@ -143,7 +142,7 @@ std::shared_ptr<Level3Message> Level3MessageFactory::Create(std::istream& is)
int16_t messageCode = header.message_code();
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);
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/level3_message_header.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
#ifdef WIN32
# include <WinSock2.h>
#else
@ -19,7 +18,8 @@ namespace rpg
{
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
{
@ -113,7 +113,7 @@ bool Level3MessageHeader::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
headerValid = false;
}
else
@ -122,52 +122,44 @@ bool Level3MessageHeader::Parse(std::istream& is)
(p->messageCode_ > -16 && p->messageCode_ < 0) ||
p->messageCode_ > 211)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid message code: " << p->messageCode_;
logger_->warn("Invalid message code: {}", p->messageCode_);
headerValid = false;
}
if (p->dateOfMessage_ > 32'767u)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid date: " << p->dateOfMessage_;
logger_->warn("Invalid date: {}", p->dateOfMessage_);
headerValid = false;
}
if (p->timeOfMessage_ > 86'399u)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid time: " << p->timeOfMessage_;
logger_->warn("Invalid time: {}", p->timeOfMessage_);
headerValid = false;
}
if (p->lengthOfMessage_ < 18 || p->lengthOfMessage_ > 1'329'270u)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid length: " << p->lengthOfMessage_;
logger_->warn("Invalid length: {}", p->lengthOfMessage_);
headerValid = false;
}
if ((p->sourceId_ > 999u && p->sourceId_ < 3000) || p->sourceId_ > 3045)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid source ID: " << p->sourceId_;
logger_->warn("Invalid source ID: {}", p->sourceId_);
headerValid = false;
}
if (p->destinationId_ > 999u)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid destination ID: " << p->destinationId_;
logger_->warn("Invalid destination ID: {}", p->destinationId_);
headerValid = false;
}
if (p->numberBlocks_ < 1u || p->numberBlocks_ > 51u)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block count: " << p->numberBlocks_;
logger_->warn("Invalid block count: {}", p->numberBlocks_);
headerValid = false;
}
}
if (headerValid)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Message code: " << p->messageCode_;
logger_->trace("Message code: {}", p->messageCode_);
}
return headerValid;

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/linked_contour_vector_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -93,22 +93,20 @@ bool LinkedContourVectorPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 0x0E03)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
if (p->initialPointIndicator_ != 0x8000)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid initial point indicator: " << p->initialPointIndicator_;
logger_->warn("Invalid initial point indicator: {}",
p->initialPointIndicator_);
blockValid = false;
}
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/linked_vector_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -12,8 +11,8 @@ namespace wsr88d
namespace rpg
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rpg::linked_vector_packet] ";
static const std::string logPrefix_ = "scwx::wsr88d::rpg::linked_vector_packet";
static const auto logger_ = util::Logger::Create(logPrefix_);
class LinkedVectorPacketImpl
{
@ -93,7 +92,7 @@ bool LinkedVectorPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else if (p->packetCode_ == 9)
@ -107,8 +106,7 @@ bool LinkedVectorPacket::Parse(std::istream& is)
{
if (p->packetCode_ != 6 && p->packetCode_ != 9)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
}

View file

@ -1,11 +1,10 @@
#include <scwx/wsr88d/rpg/mesocyclone_symbol_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <set>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -14,7 +13,8 @@ namespace rpg
{
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};
@ -77,8 +77,7 @@ bool MesocycloneSymbolPacket::ParseData(std::istream& is)
if (!packetCodes_.contains(packet_code()))
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << packet_code();
logger_->warn("Invalid packet code: {}", packet_code());
blockValid = false;
}

View file

@ -7,7 +7,7 @@ namespace wsr88d
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;

View file

@ -1,5 +1,6 @@
#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_volume_scan_times.hpp>
#include <scwx/wsr88d/rpg/digital_precipitation_data_array_packet.hpp>
@ -26,8 +27,6 @@
#include <unordered_map>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -35,7 +34,8 @@ namespace wsr88d
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&)>
CreateMessageFunction;
@ -95,17 +95,13 @@ std::shared_ptr<Packet> PacketFactory::Create(std::istream& is)
if (packetValid && create_.find(packetCode) == create_.end())
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Unknown packet code: " << packetCode << " (0x"
<< std::hex << packetCode << std::dec << ")";
logger_->warn("Unknown packet code: {0} (0x{0:x})", packetCode);
packetValid = false;
}
if (packetValid)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Found packet code: " << packetCode << " (0x"
<< std::hex << packetCode << std::dec << ")";
logger_->trace("Found packet code: {0} (0x{0:x})", packetCode);
packet = create_.at(packetCode)(is);
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/point_feature_symbol_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -95,8 +95,7 @@ bool PointFeatureSymbolPacket::ParseData(std::istream& is)
if (packet_code() != 20)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << packet_code();
logger_->warn("Invalid packet code: {}", packet_code());
blockValid = false;
}

View file

@ -1,11 +1,10 @@
#include <scwx/wsr88d/rpg/point_graphic_symbol_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <set>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -14,7 +13,8 @@ namespace rpg
{
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};
@ -70,8 +70,7 @@ bool PointGraphicSymbolPacket::ParseData(std::istream& is)
if (!packetCodes_.contains(packet_code()))
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << packet_code();
logger_->warn("Invalid packet code: {}", packet_code());
blockValid = false;
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/precipitation_rate_data_array_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -94,21 +94,19 @@ bool PrecipitationRateDataArrayPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 18)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
if (p->numberOfRows_ != 13)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid number of rows: " << p->numberOfRows_;
logger_->warn("Invalid number of rows: {}", p->numberOfRows_);
blockValid = false;
}
}
@ -131,10 +129,9 @@ bool PrecipitationRateDataArrayPacket::Parse(std::istream& is)
if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 14 ||
row.numberOfBytes_ % 2 != 0)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of bytes in row: " << row.numberOfBytes_
<< " (Row " << r << ")";
logger_->warn("Invalid number of bytes in row: {} (Row {})",
row.numberOfBytes_,
r);
blockValid = false;
break;
}

View file

@ -1,13 +1,12 @@
#include <scwx/wsr88d/rpg/product_description_block.hpp>
#include <scwx/util/float.hpp>
#include <scwx/util/logger.hpp>
#include <array>
#include <istream>
#include <set>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -16,7 +15,8 @@ namespace rpg
{
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_ = {
32, 94, 99, 134, 135, 138, 149, 152, 153, 154, 155,
@ -660,31 +660,28 @@ bool ProductDescriptionBlock::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->blockDivider_ != -1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block divider: " << p->blockDivider_;
logger_->warn("Invalid block divider: {}", p->blockDivider_);
blockValid = false;
}
if (p->productCode_ < -299 ||
(p->productCode_ > -16 && p->productCode_ < 16) ||
p->productCode_ > 299)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid product code: " << p->productCode_;
logger_->warn("Invalid product code: {}", p->productCode_);
blockValid = false;
}
}
if (blockValid)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_ << "Product code: " << p->productCode_;
logger_->trace("Product code: {}", p->productCode_);
}
const std::streampos blockEnd = is.tellg();

View file

@ -1,11 +1,10 @@
#include <scwx/wsr88d/rpg/product_symbology_block.hpp>
#include <scwx/wsr88d/rpg/packet_factory.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -14,7 +13,8 @@ namespace rpg
{
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
{
@ -87,33 +87,29 @@ bool ProductSymbologyBlock::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->blockDivider_ != -1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block divider: " << p->blockDivider_;
logger_->warn("Invalid block divider: {}", p->blockDivider_);
blockValid = false;
}
if (p->blockId_ != 1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block ID: " << p->blockId_;
logger_->warn("Invalid block ID: {}", p->blockId_);
blockValid = false;
}
if (p->lengthOfBlock_ < 10)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block length: " << p->lengthOfBlock_;
logger_->warn("Invalid block length: {}", p->lengthOfBlock_);
blockValid = false;
}
if (p->numberOfLayers_ < 1 || p->numberOfLayers_ > 18)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid number of layers: " << p->numberOfLayers_;
logger_->warn("Invalid number of layers: {}", p->numberOfLayers_);
blockValid = false;
}
}
@ -125,7 +121,7 @@ bool ProductSymbologyBlock::Parse(std::istream& is)
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;
uint32_t bytesRead = 0;
@ -156,19 +152,17 @@ bool ProductSymbologyBlock::Parse(std::istream& is)
if (bytesRead < lengthOfDataLayer)
{
BOOST_LOG_TRIVIAL(trace)
<< logPrefix_
<< "Layer bytes read smaller than size: " << bytesRead << " < "
<< lengthOfDataLayer << " bytes";
logger_->trace("Layer bytes read smaller than size: {} < {} bytes",
bytesRead,
lengthOfDataLayer);
blockValid = false;
is.seekg(layerEnd, std::ios_base::beg);
}
if (bytesRead > lengthOfDataLayer)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Layer bytes read larger than size: " << bytesRead << " > "
<< lengthOfDataLayer << " bytes";
logger_->warn("Layer bytes read larger than size: {} > {} bytes",
bytesRead,
lengthOfDataLayer);
blockValid = false;
is.seekg(layerEnd, std::ios_base::beg);
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/radar_coded_message.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -12,8 +11,8 @@ namespace wsr88d
namespace rpg
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rpg::radar_coded_message] ";
static const std::string logPrefix_ = "scwx::wsr88d::rpg::radar_coded_message";
static const auto logger_ = util::Logger::Create(logPrefix_);
class RadarCodedMessageImpl
{
@ -77,7 +76,7 @@ bool RadarCodedMessage::Parse(std::istream& is)
bool RadarCodedMessageImpl::LoadBlocks(std::istream& is)
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks";
logger_->debug("Loading Blocks");
pupSiteIdentifier_.resize(4);
productCategory_.resize(5);

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/radial_data_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -12,8 +11,8 @@ namespace wsr88d
namespace rpg
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rpg::radial_data_packet] ";
static const std::string logPrefix_ = "scwx::wsr88d::rpg::radial_data_packet";
static const auto logger_ = util::Logger::Create(logPrefix_);
class RadialDataPacketImpl
{
@ -152,29 +151,25 @@ bool RadialDataPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 0xAF1F)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
if (p->numberOfRangeBins_ < 1 || p->numberOfRangeBins_ > 460)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of range bins: " << p->numberOfRangeBins_;
logger_->warn("Invalid number of range bins: {}",
p->numberOfRangeBins_);
blockValid = false;
}
if (p->numberOfRadials_ < 1 || p->numberOfRadials_ > 400)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of radials: " << p->numberOfRadials_;
logger_->warn("Invalid number of radials: {}", p->numberOfRadials_);
blockValid = false;
}
}
@ -199,9 +194,9 @@ bool RadialDataPacket::Parse(std::istream& is)
if (radial.numberOfRleHalfwords_ < 1 ||
radial.numberOfRleHalfwords_ > 230)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid number of RLE halfwords: "
<< radial.numberOfRleHalfwords_ << " (Radial " << r << ")";
logger_->warn("Invalid number of RLE halfwords: {} (Radial {})",
radial.numberOfRleHalfwords_,
r);
blockValid = false;
break;
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/raster_data_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -12,8 +11,8 @@ namespace wsr88d
namespace rpg
{
static const std::string logPrefix_ =
"[scwx::wsr88d::rpg::raster_data_packet] ";
static const std::string logPrefix_ = "scwx::wsr88d::rpg::raster_data_packet";
static const auto logger_ = util::Logger::Create(logPrefix_);
class RasterDataPacketImpl
{
@ -162,21 +161,19 @@ bool RasterDataPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 0xBA0F && p->packetCode_ != 0xBA07)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
if (p->numberOfRows_ < 1 || p->numberOfRows_ > 464)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid number of rows: " << p->numberOfRows_;
logger_->warn("Invalid number of rows: {}", p->numberOfRows_);
blockValid = false;
}
}
@ -199,10 +196,9 @@ bool RasterDataPacket::Parse(std::istream& is)
if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 920 ||
row.numberOfBytes_ % 2 != 0)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of bytes in row: " << row.numberOfBytes_
<< " (Row " << r << ")";
logger_->warn("Invalid number of bytes in row: {} (Row {})",
row.numberOfBytes_,
r);
blockValid = false;
break;
}

View file

@ -1,11 +1,10 @@
#include <scwx/wsr88d/rpg/scit_forecast_data_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <set>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -14,7 +13,8 @@ namespace rpg
{
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};
@ -55,8 +55,7 @@ bool ScitForecastDataPacket::ParseData(std::istream& is)
if (!packetCodes_.contains(packet_code()))
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << packet_code();
logger_->warn("Invalid packet code: {}", packet_code());
blockValid = false;
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/set_color_level_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -76,22 +76,20 @@ bool SetColorLevelPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 0x0802)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
if (p->colorValueIndicator_ != 0x0002)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid color value indicator: " << p->colorValueIndicator_;
logger_->warn("Invalid color value indicator: {}",
p->colorValueIndicator_);
blockValid = false;
}
}

View file

@ -1,11 +1,10 @@
#include <scwx/wsr88d/rpg/special_graphic_symbol_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <set>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -14,7 +13,8 @@ namespace rpg
{
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_ = {
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())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
@ -82,15 +82,13 @@ bool SpecialGraphicSymbolPacket::Parse(std::istream& is)
if (!packetCodes_.contains(p->packetCode_))
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
else if (p->lengthOfBlock_ < minBlockLength ||
p->lengthOfBlock_ > maxBlockLength)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid length of block: " << p->packetCode_;
logger_->warn("Invalid length of block: {}", p->lengthOfBlock_);
blockValid = false;
}
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/sti_circle_symbol_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -71,8 +71,7 @@ bool StiCircleSymbolPacket::ParseData(std::istream& is)
if (packet_code() != 25)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << packet_code();
logger_->warn("Invalid packet code: {}", packet_code());
blockValid = false;
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/storm_id_symbol_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -71,8 +71,7 @@ bool StormIdSymbolPacket::ParseData(std::istream& is)
if (packet_code() != 15)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << packet_code();
logger_->warn("Invalid packet code: {}", packet_code());
blockValid = false;
}

View file

@ -2,12 +2,11 @@
#include <scwx/wsr88d/rpg/level3_message_header.hpp>
#include <scwx/wsr88d/rpg/packet_factory.hpp>
#include <scwx/wsr88d/rpg/product_description_block.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -16,7 +15,8 @@ namespace rpg
{
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
{
@ -92,28 +92,24 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->blockDivider1_ != -1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid first block divider: " << p->blockDivider1_;
logger_->warn("Invalid first block divider: {}", p->blockDivider1_);
blockValid = false;
}
if (p->blockId_ != 3)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block ID: " << p->blockId_;
logger_->warn("Invalid block ID: {}", p->blockId_);
blockValid = false;
}
if (p->lengthOfBlock_ < 10)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid block length: " << p->lengthOfBlock_;
logger_->warn("Invalid block length: {}", p->lengthOfBlock_);
blockValid = false;
}
}
@ -151,15 +147,12 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader)
if (p->blockDivider2_ != -1)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid second block divider: " << p->blockDivider2_;
logger_->warn("Invalid second block divider: {}", p->blockDivider2_);
blockValid = false;
}
if (p->numberOfPages_ < 1 || p->numberOfPages_ > 48)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid number of pages: " << p->numberOfPages_;
logger_->warn("Invalid number of pages: {}", p->numberOfPages_);
blockValid = false;
}
}
@ -184,10 +177,9 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader)
}
else if (numberOfCharacters > 80)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_
<< "Invalid number of characters: " << numberOfCharacters
<< " (Page " << (i + 1) << ")";
logger_->warn("Invalid number of characters: {} (Page {})",
numberOfCharacters,
(i + 1));
blockValid = false;
break;
}
@ -211,7 +203,7 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader)
}
else if (skipHeader && is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/tabular_product_message.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -82,7 +82,7 @@ bool TabularProductMessageImpl::LoadBlocks(std::istream& is)
bool tabularValid = true;
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks";
logger_->debug("Loading Blocks");
std::streampos offsetBasePos = is.tellg();
@ -99,8 +99,7 @@ bool TabularProductMessageImpl::LoadBlocks(std::istream& is)
tabularValid = tabularBlock_->Parse(is, skipTabularHeader);
is.seekg(offsetBasePos, std::ios_base::beg);
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Tabular alphanumeric block valid: " << tabularValid;
logger_->debug("Tabular alphanumeric block valid: {}", tabularValid);
if (!tabularValid)
{

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/text_and_special_symbol_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -113,21 +113,19 @@ bool TextAndSpecialSymbolPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 1 && p->packetCode_ != 2 && p->packetCode_ != 8)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
else if (p->lengthOfBlock_ < 1 || p->lengthOfBlock_ > 32767)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid length of block: " << p->packetCode_;
logger_->warn("Invalid length of block: {}", p->lengthOfBlock_);
blockValid = false;
}
else if (p->packetCode_ == 8)
@ -141,8 +139,7 @@ bool TextAndSpecialSymbolPacket::Parse(std::istream& is)
if (blockValid && textLength < 0)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Too few bytes in block: " << p->lengthOfBlock_;
logger_->warn("Too few bytes in block: {}", p->lengthOfBlock_);
blockValid = false;
}

View file

@ -1,10 +1,9 @@
#include <scwx/wsr88d/rpg/unlinked_contour_vector_packet.hpp>
#include <scwx/util/logger.hpp>
#include <istream>
#include <string>
#include <boost/log/trivial.hpp>
namespace scwx
{
namespace wsr88d
@ -13,7 +12,8 @@ namespace rpg
{
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
{
@ -80,15 +80,14 @@ bool UnlinkedContourVectorPacket::Parse(std::istream& is)
if (is.eof())
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
logger_->debug("Reached end of file");
blockValid = false;
}
else
{
if (p->packetCode_ != 0x3501)
{
BOOST_LOG_TRIVIAL(warning)
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
logger_->warn("Invalid packet code: {}", p->packetCode_);
blockValid = false;
}
}

Some files were not shown because too many files have changed in this diff Show more