1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-07-29 03:41:11 +03:00

Add toLogFields for logging

Summary: This will be needed by logging components - eg QLog

Reviewed By: hanidamlaj

Differential Revision: D72476485

fbshipit-source-id: 3b7f3e81e87fc6cc2a252293208863d33bd5df50
This commit is contained in:
Alan Frindell
2025-04-07 17:37:39 -07:00
committed by Facebook GitHub Bot
parent d153b04ec4
commit 43af96e4f9
4 changed files with 60 additions and 0 deletions

View File

@ -13,6 +13,21 @@ constexpr size_t kDestroyIndexThreshold = 50;
} // namespace
namespace quic {
PriorityQueue::PriorityLogFields HTTPPriorityQueue::toLogFields(
const PriorityQueue::Priority& pri) const {
// This is defined by the QLOG schema
auto httpPri = static_cast<const HTTPPriorityQueue::Priority&>(pri);
if (httpPri->paused) {
return {{"paused", "true"}};
}
PriorityLogFields result;
result.reserve(3);
result.emplace_back("urgency", std::to_string(httpPri->urgency));
result.emplace_back("incremental", httpPri->incremental ? "true" : "false");
result.emplace_back("order", std::to_string(httpPri->order));
return result;
}
quic::Optional<HTTPPriorityQueue::FindResult> HTTPPriorityQueue::find(
Identifier id) const {