From b7308c18fb98a65cd1dc90883e378043d220455f Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Tue, 24 Aug 2021 00:05:48 +0200 Subject: [PATCH] Implement method to update buffer in QMap --- core/src/logger/u_logger.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/logger/u_logger.cpp b/core/src/logger/u_logger.cpp index e8a54fd..521dbf4 100644 --- a/core/src/logger/u_logger.cpp +++ b/core/src/logger/u_logger.cpp @@ -58,9 +58,17 @@ void ULogger::logConnectionAttempt(ConnectionLog f_log) } -void ULogger::updateAreaBuffer(const QString &f_area, const QString &f_entry) +void ULogger::updateAreaBuffer(const QString& f_area, const QString& f_entry) { - + QQueuef_buffer = m_bufferMap.value(f_area); + if (f_buffer.length() < ConfigManager::logBuffer()) { + f_buffer.enqueue(f_entry); + } + else { + f_buffer.dequeue(); + f_buffer.enqueue(f_entry); + } + m_bufferMap.insert(f_area, f_buffer); } QQueue ULogger::buffer(const QString& f_areaName)