dash/src/batchedlogger.h

33 lines
759 B
C
Raw Normal View History

// Copyright (c) 2018-2020 The Dash Core developers
2018-09-14 13:59:02 +02:00
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_BATCHEDLOGGER_H
#define BITCOIN_BATCHEDLOGGER_H
2018-09-14 13:59:02 +02:00
#include <logging.h>
2018-09-14 13:59:02 +02:00
class CBatchedLogger
{
private:
bool accept;
2018-09-14 13:59:02 +02:00
std::string header;
std::string msg;
public:
CBatchedLogger(BCLog::LogFlags _category, const std::string& _header);
2018-09-14 13:59:02 +02:00
virtual ~CBatchedLogger();
template<typename... Args>
void Batch(const std::string& fmt, const Args&... args)
2018-09-14 13:59:02 +02:00
{
if (!accept) {
return;
}
msg += " " + strprintf(fmt, args...) + "\n";
2018-09-14 13:59:02 +02:00
}
void Flush();
};
#endif//BITCOIN_BATCHEDLOGGER_H