dash/src/batchedlogger.cpp
Alexander Block b87821047c
Make LLMQ/InstantSend/ChainLocks code less spammy (#2781)
* Add support for log category to CBatchedLogger

* Use "llmq" logging category in LLMQ code

* Use "chainlocks" logging category in ChainLocks code

* Log errors without logging category
2019-03-21 07:46:27 +01:00

26 lines
609 B
C++

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