Boost.Log -> spdlog - qt/map

This commit is contained in:
Dan Paulat 2022-04-18 09:09:02 -05:00
parent 15bc3afc87
commit e6bddc79db
7 changed files with 47 additions and 48 deletions

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,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"))
{