5#if defined(HAVE_CONFIG_H)
6#include <config/bitcoin-config.h>
46 "Elliptic curve cryptography sanity check failure. Aborting."));
55 "OS cryptographic RNG sanity check failure. Aborting."));
67 "-debuglogfile=<file>",
68 strprintf(
"Specify location of debug log file. Relative paths will be "
69 "prefixed by a net-specific datadir location. "
70 "(-nodebuglogfile to disable; default: %s)",
73 argsman.AddArg(
"-debug=<category>",
74 "Output debugging information (default: -nodebug, supplying "
75 "<category> is optional). "
76 "If <category> is not supplied or if <category> = 1, output "
77 "all debugging information. <category> can be: " +
79 ". This option can be specified multiple times to "
80 "output multiple categories.",
83 "-debugexclude=<category>",
85 "Exclude debugging information for a category. Can be used in "
86 "conjunction with -debug=1 to output debug logs for all categories "
87 "except the specified category. This option can be specified "
88 "multiple times to exclude multiple categories."),
92 strprintf(
"Include IP addresses in debug output (default: %u)",
97 strprintf(
"Prepend debug output with timestamp (default: %u)",
100#ifdef HAVE_THREAD_LOCAL
104 "Prepend debug output with name of the originating thread (only "
105 "available on platforms supporting thread_local) (default: %u)",
109 argsman.AddHiddenArgs({
"-logthreadnames"});
112 "-logsourcelocations",
114 "Prepend debug output with name of the originating source location "
115 "(source file, line number and function name) (default: %u)",
120 strprintf(
"Add microsecond precision to debug timestamps (default: %u)",
124 argsman.AddArg(
"-printtoconsole",
125 "Send trace/debug info to console (default: 1 when no "
126 "-daemon. To disable logging to file, set -nodebuglogfile)",
128 argsman.AddArg(
"-printpriority",
129 strprintf(
"Log transaction priority and fee per kB when "
130 "mining blocks (default: %d)",
131 DEFAULT_PRINTPRIORITY),
136 "Shrink debug.log file on client startup (default: 1 when no -debug)",
151#ifdef HAVE_THREAD_LOCAL
169 [](std::string
cat) { return cat ==
"0" || cat ==
"none"; })) {
173 strprintf(
_(
"Unsupported logging category %s=%s."),
181 for (
const std::string &
cat : args.
GetArgs(
"-debugexclude")) {
184 "-debugexclude",
cat));
191 if (
logger.m_print_to_file) {
193 logger.DefaultShrinkDebugFile())) {
201 if (!
logger.StartLogging()) {
207 if (!
logger.m_log_timestamps) {
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",
fs::path GetDefaultDataDir()
fs::path AbsPathForConfigVal(const ArgsManager &args, const fs::path &path, bool net_specific=true)
Most paths passed as configuration arguments are treated as relative to the datadir if they are not a...
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.
fs::path GetDataDirNet() const
Get data directory path with appended network identifier.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
fs::path GetConfigFilePath() const
Return config file path (read-only)
void LogArgs() const
Log the config file options and the command line arguments, useful for troubleshooting.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
fs::path GetPathArg(std::string arg, const fs::path &default_value={}) const
Return path argument or default value.
bool m_log_sourcelocations
void DisableCategory(LogFlags category)
void EnableCategory(LogFlags category)
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.
BCLog::Logger & LogInstance()
const char *const DEFAULT_DEBUGLOGFILE
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 byte string.
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.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::string SHA256AutoDetect()
Autodetect the best available SHA256 implementation.
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
bool ChronoSanityCheck()
Sanity check epoch match normal Unix epoch.
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.