dash/src/batchedlogger.cpp
pasta f04cf7bf47
16659 continuation
Signed-off-by: pasta <pasta@dashboost.org>
2021-12-17 12:02:16 -05:00

25 lines
599 B
C++

// Copyright (c) 2018-2020 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, const std::string& _header) :
accept(LogAcceptCategory(_category)), header(_header)
{
}
CBatchedLogger::~CBatchedLogger()
{
Flush();
}
void CBatchedLogger::Flush()
{
if (!accept || msg.empty()) {
return;
}
LogInstance().LogPrintStr(strprintf("%s:\n%s", header, msg));
msg.clear();
}