aboutsummaryrefslogtreecommitdiff
path: root/src/logging.h
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2018-05-03 11:09:28 +1000
committerMarcoFalke <falke.marco@gmail.com>2019-05-28 14:26:42 -0400
commit0b282f9b00da08734e2381477aad32d64b933745 (patch)
treeecc2d8957a556773296dbde794f5f330c4d3f5cb /src/logging.h
parent412987430c98e78ccda033ab1cf7a176a4c0b835 (diff)
downloadbitcoin-0b282f9b00da08734e2381477aad32d64b933745.tar.xz
Log early messages with -printtoconsole
This ensures log messages prior to StartLogging() are replayed to the console as well as to the debug log file.
Diffstat (limited to 'src/logging.h')
-rw-r--r--src/logging.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/logging.h b/src/logging.h
index 4fa9e0c8a4..f40a10bc4c 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -63,6 +63,7 @@ namespace BCLog {
FILE* m_fileout = nullptr;
std::mutex m_file_mutex;
std::list<std::string> m_msgs_before_open;
+ bool m_buffering = true; //!< Buffer messages before logging can be started
/**
* m_started_new_line is a state variable that will suppress printing of
@@ -91,9 +92,11 @@ namespace BCLog {
void LogPrintStr(const std::string &str);
/** Returns whether logs will be written to any output */
- bool Enabled() const { return m_print_to_console || m_print_to_file; }
+ bool Enabled() const { return m_buffering || m_print_to_console || m_print_to_file; }
+ /** Start logging (and flush all buffered messages) */
bool StartLogging();
+
void ShrinkDebugFile();
uint32_t GetCategoryMask() const { return m_categories.load(); }