Changeset View
Changeset View
Standalone View
Standalone View
src/logging.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Copyright (c) 2017-2018 The Bitcoin developers | // Copyright (c) 2017-2018 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_LOGGING_H | #ifndef BITCOIN_LOGGING_H | ||||
#define BITCOIN_LOGGING_H | #define BITCOIN_LOGGING_H | ||||
#include <atomic> | #include <atomic> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <list> | #include <list> | ||||
#include <mutex> | |||||
#include <string> | #include <string> | ||||
#include <boost/thread/mutex.hpp> | |||||
static const bool DEFAULT_LOGTIMEMICROS = false; | static const bool DEFAULT_LOGTIMEMICROS = false; | ||||
static const bool DEFAULT_LOGIPS = false; | static const bool DEFAULT_LOGIPS = false; | ||||
static const bool DEFAULT_LOGTIMESTAMPS = true; | static const bool DEFAULT_LOGTIMESTAMPS = true; | ||||
extern bool fLogIPs; | extern bool fLogIPs; | ||||
namespace BCLog { | namespace BCLog { | ||||
Show All 21 Lines | enum LogFlags : uint32_t { | ||||
QT = (1 << 19), | QT = (1 << 19), | ||||
LEVELDB = (1 << 20), | LEVELDB = (1 << 20), | ||||
ALL = ~uint32_t(0), | ALL = ~uint32_t(0), | ||||
}; | }; | ||||
class Logger { | class Logger { | ||||
private: | private: | ||||
FILE *fileout = nullptr; | FILE *fileout = nullptr; | ||||
boost::mutex mutexDebugLog; | std::mutex mutexDebugLog; | ||||
std::list<std::string> vMsgsBeforeOpenLog; | std::list<std::string> vMsgsBeforeOpenLog; | ||||
/** | /** | ||||
* fStartedNewLine is a state variable that will suppress printing of the | * fStartedNewLine is a state variable that will suppress printing of the | ||||
* timestamp when multiple calls are made that don't end in a newline. | * timestamp when multiple calls are made that don't end in a newline. | ||||
*/ | */ | ||||
std::atomic_bool fStartedNewLine{true}; | std::atomic_bool fStartedNewLine{true}; | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |