Update main_window.cpp to use spdlog instead of boost log

This commit is contained in:
Dan Paulat 2022-04-13 20:09:00 -05:00
parent 20b8c75234
commit 3d162f0336
2 changed files with 9 additions and 11 deletions

View file

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

View file

@ -102,7 +102,7 @@
<context> <context>
<name>scwx::qt::main::MainWindow</name> <name>scwx::qt::main::MainWindow</name>
<message> <message>
<location filename="../source/scwx/qt/main/main_window.cpp" line="279"/> <location filename="../source/scwx/qt/main/main_window.cpp" line="278"/>
<source>Unrecognized NEXRAD Product:</source> <source>Unrecognized NEXRAD Product:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>