5 #if defined(HAVE_CONFIG_H)
6 #include <config/bitcoin-config.h>
31 LogPrintf(
"Using the '%s' SHA256 implementation\n", sha256_algo);
45 "Elliptic curve cryptography sanity check failure. Aborting."));
54 "OS cryptographic RNG sanity check failure. Aborting."));
66 "-debuglogfile=<file>",
67 strprintf(
"Specify location of debug log file. Relative paths will be "
68 "prefixed by a net-specific datadir location. "
69 "(-nodebuglogfile to disable; default: %s)",
72 argsman.
AddArg(
"-debug=<category>",
73 "Output debugging information (default: -nodebug, supplying "
74 "<category> is optional). "
75 "If <category> is not supplied or if <category> = 1, output "
76 "all debugging information. <category> can be: " +
78 ". This option can be specified multiple times to "
79 "output multiple categories.",
82 "-debugexclude=<category>",
84 "Exclude debugging information for a category. Can be used in "
85 "conjunction with -debug=1 to output debug logs for all categories "
86 "except the specified category. This option can be specified "
87 "multiple times to exclude multiple categories."),
91 strprintf(
"Include IP addresses in debug output (default: %u)",
96 strprintf(
"Prepend debug output with timestamp (default: %u)",
99 #ifdef HAVE_THREAD_LOCAL
103 "Prepend debug output with name of the originating thread (only "
104 "available on platforms supporting thread_local) (default: %u)",
111 "-logsourcelocations",
113 "Prepend debug output with name of the originating source location "
114 "(source file, line number and function name) (default: %u)",
119 strprintf(
"Add microsecond precision to debug timestamps (default: %u)",
123 argsman.
AddArg(
"-printtoconsole",
124 "Send trace/debug info to console (default: 1 when no "
125 "-daemon. To disable logging to file, set -nodebuglogfile)",
127 argsman.
AddArg(
"-printpriority",
128 strprintf(
"Log transaction priority and fee per kB when "
129 "mining blocks (default: %d)",
135 "Shrink debug.log file on client startup (default: 1 when no -debug)",
150 #ifdef HAVE_THREAD_LOCAL
164 const std::vector<std::string> categories = args.
GetArgs(
"-debug");
167 categories.begin(), categories.end(),
168 [](std::string cat) { return cat ==
"0" || cat ==
"none"; })) {
169 for (
const auto &cat : categories) {
172 strprintf(
_(
"Unsupported logging category %s=%s."),
180 for (
const std::string &cat : args.
GetArgs(
"-debugexclude")) {
183 "-debugexclude", cat));
219 }
else if (args.
IsArgSet(
"-conf")) {
222 strprintf(
_(
"The specified config file %s does not exist\n"),
226 LogPrintf(
"Config file: %s (not found, skipping)\n",
239 version_string +=
" (debug build)";
241 version_string +=
" (release build)";
bool IsArgNegated(const std::string &strArg) const
Return true if the argument was originally passed as a negated option, i.e.
std::vector< std::string > GetArgs(const std::string &strArg) const
Return a vector of strings of the given argument.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
void LogArgs() const
Log the config file options and the command line arguments, useful for troubleshooting.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void AddHiddenArgs(const std::vector< std::string > &args)
Add many hidden arguments.
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
bool DefaultShrinkDebugFile() const
Default for whether ShrinkDebugFile should be run.
bool m_log_sourcelocations
bool StartLogging()
Start logging (and flush all buffered messages)
Users of this module must hold an ECCVerifyHandle.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
std::string FormatFullVersion()
const std::string CLIENT_NAME
static std::unique_ptr< ECCVerifyHandle > globalVerifyHandle
bool glibcxx_sanity_test()
bool ECC_InitSanityCheck()
Check that required EC support is available at runtime.
void ECC_Start()
Initialize the elliptic curve support.
void ECC_Stop()
Deinitialize the elliptic curve support.
const char *const DEFAULT_DEBUGLOGFILE
BCLog::Logger & LogInstance()
static const bool DEFAULT_LOGTIMESTAMPS
static const bool DEFAULT_LOGIPS
static const bool DEFAULT_LOGTHREADNAMES
static const bool DEFAULT_LOGSOURCELOCATIONS
static const bool DEFAULT_LOGTIMEMICROS
static bool exists(const path &p)
static std::string PathToString(const path &path)
Convert path object to a byte string.
static path PathFromString(const std::string &string)
Convert byte string to path object.
void AddLoggingArgs(ArgsManager &argsman)
void SetLoggingCategories(const ArgsManager &args)
bool SanityChecks()
Ensure a usable environment with all necessary library support.
bool StartLogging(const ArgsManager &args)
void SetLoggingOptions(const ArgsManager &args)
static const bool DEFAULT_PRINTPRIORITY
bool Random_SanityCheck()
Check that OS randomness is available and returning the requested number of bytes.
void RandomInit()
Initialize global RNG state and log any CPU features that are used.
std::string SHA256AutoDetect()
Autodetect the best available SHA256 implementation.
fs::path GetDefaultDataDir()
fs::path AbsPathForConfigVal(const fs::path &path, bool net_specific)
Most paths passed as configuration arguments are treated as relative to the datadir if they are not a...
fs::path GetConfigFile(const std::string &confPath)
const char *const BITCOIN_CONF_FILENAME
bool ChronoSanityCheck()
Sanity check epoch match normal Unix epoch.
T GetTime()
Return system time (or mocked time, if set)
std::string FormatISO8601DateTime(int64_t nTime)
ISO 8601 formatting is preferred.
bilingual_str _(const char *psz)
Translation function.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
void InitWarning(const bilingual_str &str)
Show warning message.
bool InitError(const bilingual_str &str)
Show error message.