dash/src/batchedlogger.h
Pieter Wuille 671f1f8943
Merge #12954: util: Refactor logging code into a global object
8c2d695c4a util: Store debug log file path in BCLog::Logger member. (Jim Posen)
8e7b961388 scripted-diff: Rename BCLog::Logger member variables. (Jim Posen)
1eac317f25 util: Refactor GetLogCategory. (Jim Posen)
3316a9ebb6 util: Encapsulate logCategories within BCLog::Logger. (Jim Posen)
6a6d764ca5 util: Move debug file management functions into Logger. (Jim Posen)
f55f4fcf05 util: Establish global logger object. (Jim Posen)

Pull request description:

  This is purely a refactor with no behavior changes.

  This creates a new class `BCLog::Logger` to encapsulate all global logging configuration and state.

Tree-SHA512: b34811f54a53b7375d7b6f84925453c6f2419d21179379ee28b3843d0f4ff8e22020de84a5e783453ea927e9074e32de8ecd05a6fa50d7bb05502001aaed8e53
2021-05-25 14:09:35 +03:00

33 lines
759 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.
#ifndef BITCOIN_BATCHEDLOGGER_H
#define BITCOIN_BATCHEDLOGGER_H
#include <logging.h>
class CBatchedLogger
{
private:
bool accept;
std::string header;
std::string msg;
public:
CBatchedLogger(BCLog::LogFlags _category, const std::string& _header);
virtual ~CBatchedLogger();
template<typename... Args>
void Batch(const std::string& fmt, const Args&... args)
{
if (!accept) {
return;
}
msg += " " + strprintf(fmt, args...) + "\n";
}
void Flush();
};
#endif//BITCOIN_BATCHEDLOGGER_H