mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
b046e091c9
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
31 lines
899 B
C++
31 lines
899 B
C++
// Copyright (c) 2018-2023 The Dash Core developers
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <batchedlogger.h>
|
|
|
|
CBatchedLogger::CBatchedLogger(BCLog::LogFlags category, BCLog::Level level, const std::string& logging_function,
|
|
const std::string& source_file, int source_line) :
|
|
m_accept{LogAcceptCategory(category, level)},
|
|
m_category{category},
|
|
m_level{level},
|
|
m_logging_function{logging_function},
|
|
m_source_file{source_file},
|
|
m_source_line{source_line}
|
|
{
|
|
}
|
|
|
|
CBatchedLogger::~CBatchedLogger()
|
|
{
|
|
Flush();
|
|
}
|
|
|
|
void CBatchedLogger::Flush()
|
|
{
|
|
if (!m_accept || m_msg.empty()) {
|
|
return;
|
|
}
|
|
LogInstance().LogPrintStr(m_msg, m_logging_function, m_source_file, m_source_line, m_category, m_level);
|
|
m_msg.clear();
|
|
}
|