Add more logging

This commit is contained in:
kssenii 2024-03-21 18:22:11 +01:00
parent b1e03abc1f
commit 87b1e0ead2
3 changed files with 11 additions and 1 deletions

View File

@ -37,6 +37,7 @@ LRUFileCachePriority::LRUFileCachePriority(
const std::string & description_)
: IFileCachePriority(max_size_, max_elements_)
, description(description_)
, log(getLogger("LRUFileCachePriority{}" + (description.empty() ? "" : "(" + description + ")")))
{
if (state_)
state = state_;

View File

@ -86,7 +86,7 @@ private:
LRUQueue queue;
const std::string description;
LoggerPtr log = getLogger("LRUFileCachePriority");
LoggerPtr log;
StatePtr state;
void updateElementsCount(int64_t num);

View File

@ -215,7 +215,16 @@ bool SLRUFileCachePriority::collectCandidatesForEviction(
hold_space = std::make_shared<HoldSpace>(
hold_size, hold_elements, QueueEntryType::SLRU_Probationary, probationary_queue, lock);
LOG_TEST(log, "Eviction candidates: {}, hold space: {} in size and {} in elements. {}",
res.size(), hold_size, hold_elements, getStateInfoForLog(lock));
}
else
{
LOG_TEST(log, "Eviction candidates: {}, hold space: none. {}",
res.size(), getStateInfoForLog(lock));
}
auto downgrade_func = [=, this]
(const CachePriorityGuard::Lock & lk)