mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 04:10:06 +00:00
Add debug log statements to archive warning loading
This commit is contained in:
parent
65e3a66750
commit
8dde98d2a9
4 changed files with 29 additions and 6 deletions
|
|
@ -462,11 +462,16 @@ void TextEventManager::Impl::LoadArchives(
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<awips::TextProductFile>> products {};
|
||||
|
||||
// Load the load list
|
||||
auto loadView =
|
||||
loadListEntries | ranges::views::transform([](const auto& entry)
|
||||
{ return entry.productId_; });
|
||||
auto products = provider::IemApiProvider::LoadTextProducts(loadView);
|
||||
if (!loadListEntries.empty())
|
||||
{
|
||||
auto loadView = loadListEntries |
|
||||
ranges::views::transform([](const auto& entry)
|
||||
{ return entry.productId_; });
|
||||
products = provider::IemApiProvider::LoadTextProducts(loadView);
|
||||
}
|
||||
|
||||
// Process loaded products
|
||||
for (auto& product : products)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <scwx/awips/text_product_file.hpp>
|
||||
#include <scwx/types/iem_types.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
|
@ -69,6 +70,8 @@ private:
|
|||
ProcessTextProductFiles(
|
||||
std::vector<std::pair<std::string, cpr::AsyncResponse>>& asyncResponses);
|
||||
|
||||
static const std::shared_ptr<spdlog::logger> logger_;
|
||||
|
||||
static const std::string kBaseUrl_;
|
||||
static const std::string kListNwsTextProductsEndpoint_;
|
||||
static const std::string kNwsTextProductEndpoint_;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@
|
|||
|
||||
#include <scwx/provider/iem_api_provider.hpp>
|
||||
#include <scwx/network/cpr.hpp>
|
||||
#include <scwx/util/time.hpp>
|
||||
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <cpr/cpr.h>
|
||||
#include <range/v3/view/cartesian_product.hpp>
|
||||
#include <range/v3/view/single.hpp>
|
||||
#include <range/v3/view/transform.hpp>
|
||||
|
||||
#if (__cpp_lib_chrono < 201907L)
|
||||
# include <date/date.h>
|
||||
|
|
@ -39,6 +42,13 @@ IemApiProvider::ListTextProducts(DateRange dates,
|
|||
# define kDateFormat "%Y-%m-%d"
|
||||
#endif
|
||||
|
||||
auto formattedDates = dates | ranges::views::transform(
|
||||
[](const std::chrono::sys_days& date)
|
||||
{ return df::format(kDateFormat, date); });
|
||||
|
||||
logger_->debug("Listing text products for: {}",
|
||||
boost::algorithm::join(formattedDates, ", "));
|
||||
|
||||
std::vector<cpr::AsyncResponse> asyncResponses {};
|
||||
|
||||
for (const auto& [date, cccc, pil] :
|
||||
|
|
@ -75,6 +85,8 @@ IemApiProvider::LoadTextProducts(const Range& textProducts)
|
|||
{
|
||||
auto parameters = cpr::Parameters {{"nolimit", "true"}};
|
||||
|
||||
logger_->debug("Loading {} text products", textProducts.size());
|
||||
|
||||
std::vector<std::pair<std::string, cpr::AsyncResponse>> asyncResponses {};
|
||||
asyncResponses.reserve(textProducts.size());
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ namespace scwx::provider
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::provider::iem_api_provider";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
const auto IemApiProvider::logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
const std::string IemApiProvider::kBaseUrl_ =
|
||||
"https://mesonet.agron.iastate.edu/api/1";
|
||||
|
|
@ -140,7 +141,7 @@ IemApiProvider::ProcessTextProductLists(
|
|||
}
|
||||
}
|
||||
|
||||
logger_->trace("Found {} products", textProducts.size());
|
||||
logger_->debug("Found {} products", textProducts.size());
|
||||
|
||||
return textProducts;
|
||||
}
|
||||
|
|
@ -175,6 +176,8 @@ IemApiProvider::ProcessTextProductFiles(
|
|||
}
|
||||
}
|
||||
|
||||
logger_->debug("Loaded {} text products", textProductFiles.size());
|
||||
|
||||
return textProductFiles;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue