MCPcopy Create free account
hub / github.com/ElementsProject/elements / StartLogging

Function StartLogging

src/init/common.cpp:122–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122bool StartLogging(const ArgsManager& args)
123{
124 if (LogInstance().m_print_to_file) {
125 if (args.GetBoolArg("-shrinkdebugfile", LogInstance().DefaultShrinkDebugFile())) {
126 // Do this first since it both loads a bunch of debug.log into memory,
127 // and because this needs to happen before any other debug.log printing
128 LogInstance().ShrinkDebugFile();
129 }
130 }
131 if (!LogInstance().StartLogging()) {
132 return InitError(strprintf(Untranslated("Could not open debug log file %s"),
133 fs::PathToString(LogInstance().m_file_path)));
134 }
135
136 if (!LogInstance().m_log_timestamps)
137 LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
138 LogPrintf("Default data directory %s\n", fs::PathToString(GetDefaultDataDir()));
139 LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
140
141 // Only log conf file usage message if conf file actually exists.
142 fs::path config_file_path = GetConfigFile(args.GetArg("-conf", BITCOIN_CONF_FILENAME));
143 if (fs::exists(config_file_path)) {
144 LogPrintf("Config file: %s\n", fs::PathToString(config_file_path));
145 } else if (args.IsArgSet("-conf")) {
146 // Warn if no conf file exists at path provided by user
147 InitWarning(strprintf(_("The specified config file %s does not exist"), fs::PathToString(config_file_path)));
148 } else {
149 // Not categorizing as "Warning" because it's the default behavior
150 LogPrintf("Config file: %s (not found, skipping)\n", fs::PathToString(config_file_path));
151 }
152
153 // Log the config arguments to debug.log
154 args.LogArgs();
155
156 return true;
157}
158
159void LogPackageVersion()
160{

Callers 1

AppInitMainFunction · 0.85

Calls 15

InitErrorFunction · 0.85
UntranslatedFunction · 0.85
PathToStringFunction · 0.85
GetTimeFunction · 0.85
GetDefaultDataDirFunction · 0.85
GetConfigFileFunction · 0.85
existsFunction · 0.85
InitWarningFunction · 0.85
_Function · 0.85
GetBoolArgMethod · 0.80
ShrinkDebugFileMethod · 0.80

Tested by

no test coverage detected