Skip to content

Commit fa39b1c

Browse files
author
MarcoFalke
committed
doc: move-only logging warning
Put the warning closer to where it is relevant. That is, put it close to the functions that actually do unconditional logging. Also, remove a stray empty line.
1 parent e46bebb commit fa39b1c

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/logging.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2022 The Bitcoin Core developers
2+
// Copyright (c) 2009-present The Bitcoin Core developers
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -103,7 +103,6 @@ void BCLog::Logger::DisconnectTestLogger()
103103
m_cur_buffer_memusage = 0;
104104
m_buffer_lines_discarded = 0;
105105
m_msgs_before_open.clear();
106-
107106
}
108107

109108
void BCLog::Logger::DisableLogging()

src/logging.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2022 The Bitcoin Core developers
2+
// Copyright (c) 2009-present The Bitcoin Core developers
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -245,10 +245,6 @@ static inline bool LogAcceptCategory(BCLog::LogFlags category, BCLog::Level leve
245245
/** Return true if str parses as a log category and set the flag */
246246
bool GetLogCategory(BCLog::LogFlags& flag, std::string_view str);
247247

248-
// Be conservative when using functions that
249-
// unconditionally log to debug.log! It should not be the case that an inbound
250-
// peer can fill up a user's disk with debug.log entries.
251-
252248
template <typename... Args>
253249
static inline void LogPrintf_(std::string_view logging_function, std::string_view source_file, const int source_line, const BCLog::LogFlags flag, const BCLog::Level level, const char* fmt, const Args&... args)
254250
{
@@ -267,6 +263,9 @@ static inline void LogPrintf_(std::string_view logging_function, std::string_vie
267263
#define LogPrintLevel_(category, level, ...) LogPrintf_(__func__, __FILE__, __LINE__, category, level, __VA_ARGS__)
268264

269265
// Log unconditionally.
266+
// Be conservative when using functions that unconditionally log to debug.log!
267+
// It should not be the case that an inbound peer can fill up a user's storage
268+
// with debug.log entries.
270269
#define LogInfo(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Info, __VA_ARGS__)
271270
#define LogWarning(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Warning, __VA_ARGS__)
272271
#define LogError(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Error, __VA_ARGS__)

0 commit comments

Comments
 (0)