Replace OpenDebugLog() with StartLogging()
StartLogging() is used to mark the start of logging generically, whether using -printtoconsole or -debuglogfile.
This commit is contained in:
parent
8ab4f282c0
commit
412987430c
3 changed files with 5 additions and 4 deletions
|
@ -1249,10 +1249,10 @@ bool AppInitMain(InitInterfaces& interfaces)
|
||||||
// and because this needs to happen before any other debug.log printing
|
// and because this needs to happen before any other debug.log printing
|
||||||
LogInstance().ShrinkDebugFile();
|
LogInstance().ShrinkDebugFile();
|
||||||
}
|
}
|
||||||
if (!LogInstance().OpenDebugLog()) {
|
}
|
||||||
|
if (!LogInstance().StartLogging()) {
|
||||||
return InitError(strprintf("Could not open debug log file %s",
|
return InitError(strprintf("Could not open debug log file %s",
|
||||||
LogInstance().m_file_path.string()));
|
LogInstance().m_file_path.string()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LogInstance().m_log_timestamps)
|
if (!LogInstance().m_log_timestamps)
|
||||||
|
|
|
@ -39,9 +39,10 @@ static int FileWriteStr(const std::string &str, FILE *fp)
|
||||||
return fwrite(str.data(), 1, str.size(), fp);
|
return fwrite(str.data(), 1, str.size(), fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BCLog::Logger::OpenDebugLog()
|
bool BCLog::Logger::StartLogging()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> scoped_lock(m_file_mutex);
|
std::lock_guard<std::mutex> scoped_lock(m_file_mutex);
|
||||||
|
if (!m_print_to_file) return true;
|
||||||
|
|
||||||
assert(m_fileout == nullptr);
|
assert(m_fileout == nullptr);
|
||||||
assert(!m_file_path.empty());
|
assert(!m_file_path.empty());
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace BCLog {
|
||||||
/** Returns whether logs will be written to any output */
|
/** 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_print_to_console || m_print_to_file; }
|
||||||
|
|
||||||
bool OpenDebugLog();
|
bool StartLogging();
|
||||||
void ShrinkDebugFile();
|
void ShrinkDebugFile();
|
||||||
|
|
||||||
uint32_t GetCategoryMask() const { return m_categories.load(); }
|
uint32_t GetCategoryMask() const { return m_categories.load(); }
|
||||||
|
|
Loading…
Reference in a new issue