diff options
author | Jim Posen <jimpo@coinbase.com> | 2018-04-11 10:03:21 -0700 |
---|---|---|
committer | Jim Posen <jimpo@coinbase.com> | 2018-04-27 16:09:59 -0700 |
commit | f55f4fcf05a53fdf618b4c69ddcf4c43b14e84c2 (patch) | |
tree | d5e549d544757a7d0aa1bd2fbcef5be376af8823 /src/init.cpp | |
parent | 17266a13067c061783e0428c6200985ed8872b16 (diff) |
util: Establish global logger object.
The object encapsulates logging configuration, and in a later commit,
set up routines will also be moved into the class.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/init.cpp b/src/init.cpp index 99dab605ac..814fd39448 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -305,7 +305,7 @@ static void HandleSIGTERM(int) static void HandleSIGHUP(int) { - fReopenDebugLog = true; + g_logger->fReopenDebugLog = true; } #ifndef WIN32 @@ -831,10 +831,11 @@ void InitLogging() // debug.log. LogPrintf("\n\n\n\n\n"); - fPrintToConsole = gArgs.GetBoolArg("-printtoconsole", !gArgs.GetBoolArg("-daemon", false)); - fPrintToDebugLog = !gArgs.IsArgNegated("-debuglogfile"); - fLogTimestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS); - fLogTimeMicros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS); + g_logger->fPrintToConsole = gArgs.GetBoolArg("-printtoconsole", !gArgs.GetBoolArg("-daemon", false)); + g_logger->fPrintToDebugLog = !gArgs.IsArgNegated("-debuglogfile"); + g_logger->fLogTimestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS); + g_logger->fLogTimeMicros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS); + fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS); std::string version_string = FormatFullVersion(); @@ -1230,7 +1231,7 @@ bool AppInitMain() #ifndef WIN32 CreatePidFile(GetPidFile(), getpid()); #endif - if (fPrintToDebugLog) { + if (g_logger->fPrintToDebugLog) { if (gArgs.GetBoolArg("-shrinkdebugfile", logCategories == BCLog::NONE)) { // Do this first since it both loads a bunch of debug.log into memory, // and because this needs to happen before any other debug.log printing @@ -1241,7 +1242,7 @@ bool AppInitMain() } } - if (!fLogTimestamps) + if (!g_logger->fLogTimestamps) LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime())); LogPrintf("Default data directory %s\n", GetDefaultDataDir().string()); LogPrintf("Using data directory %s\n", GetDataDir().string()); |