Add debug log statements to archive warning loading

This commit is contained in:
Dan Paulat 2025-04-26 09:47:50 -05:00
parent 65e3a66750
commit 8dde98d2a9
4 changed files with 29 additions and 6 deletions

View file

@ -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_;

View file

@ -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());

View file

@ -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;
}