util: Store debug log file path in BCLog::Logger member.

This breaks the cyclic between logging and util.
This commit is contained in:
Jim Posen
2018-04-20 01:11:44 -07:00
parent 8e7b961388
commit 8c2d695c4a
5 changed files with 16 additions and 21 deletions

View File

@@ -826,13 +826,15 @@ static std::string ResolveErrMsg(const char * const optname, const std::string&
*/
void InitLogging()
{
g_logger->m_print_to_file = !gArgs.IsArgNegated("-debuglogfile");
g_logger->m_file_path = AbsPathForConfigVal(gArgs.GetArg("-debuglogfile", DEFAULT_DEBUGLOGFILE));
// Add newlines to the logfile to distinguish this execution from the last
// one; called before console logging is set up, so this is only sent to
// debug.log.
LogPrintf("\n\n\n\n\n");
g_logger->m_print_to_console = gArgs.GetBoolArg("-printtoconsole", !gArgs.GetBoolArg("-daemon", false));
g_logger->m_print_to_file = !gArgs.IsArgNegated("-debuglogfile");
g_logger->m_log_timestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS);
g_logger->m_log_time_micros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);
@@ -1233,7 +1235,7 @@ bool AppInitMain()
}
if (!g_logger->OpenDebugLog()) {
return InitError(strprintf("Could not open debug log file %s",
g_logger->GetDebugLogPath().string()));
g_logger->m_file_path.string()));
}
}