Skip to content

Commit 4129874

Browse files
ajtownsMarcoFalke
authored andcommitted
Replace OpenDebugLog() with StartLogging()
StartLogging() is used to mark the start of logging generically, whether using -printtoconsole or -debuglogfile.
1 parent 8ab4f28 commit 4129874

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,10 +1249,10 @@ bool AppInitMain(InitInterfaces& interfaces)
12491249
// and because this needs to happen before any other debug.log printing
12501250
LogInstance().ShrinkDebugFile();
12511251
}
1252-
if (!LogInstance().OpenDebugLog()) {
1252+
}
1253+
if (!LogInstance().StartLogging()) {
12531254
return InitError(strprintf("Could not open debug log file %s",
12541255
LogInstance().m_file_path.string()));
1255-
}
12561256
}
12571257

12581258
if (!LogInstance().m_log_timestamps)

src/logging.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ static int FileWriteStr(const std::string &str, FILE *fp)
3939
return fwrite(str.data(), 1, str.size(), fp);
4040
}
4141

42-
bool BCLog::Logger::OpenDebugLog()
42+
bool BCLog::Logger::StartLogging()
4343
{
4444
std::lock_guard<std::mutex> scoped_lock(m_file_mutex);
45+
if (!m_print_to_file) return true;
4546

4647
assert(m_fileout == nullptr);
4748
assert(!m_file_path.empty());

src/logging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ namespace BCLog {
9393
/** Returns whether logs will be written to any output */
9494
bool Enabled() const { return m_print_to_console || m_print_to_file; }
9595

96-
bool OpenDebugLog();
96+
bool StartLogging();
9797
void ShrinkDebugFile();
9898

9999
uint32_t GetCategoryMask() const { return m_categories.load(); }

0 commit comments

Comments
 (0)