5 #if defined(HAVE_CONFIG_H) 29 argsman.
AddArg(
"-debug=<category>",
"Output debug and trace logging (default: -nodebug, supplying <category> is optional). " 30 "If <category> is not supplied or if <category> = 1, output all debug and trace logging. <category> can be: " +
LogInstance().LogCategoriesString() +
". This option can be specified multiple times to output multiple categories.",
32 argsman.
AddArg(
"-debugexclude=<category>",
"Exclude debug and trace logging for a category. Can be used in conjunction with -debug=1 to output debug and trace logging for all categories except the specified category. This option can be specified multiple times to exclude multiple categories.",
ArgsManager::ALLOW_ANY,
OptionsCategory::DEBUG_TEST);
36 #ifdef HAVE_THREAD_LOCAL 54 #ifdef HAVE_THREAD_LOCAL 65 for (
const std::string& level_str :
args.
GetArgs(
"-loglevel")) {
66 if (level_str.find_first_of(
':', 3) == std::string::npos) {
75 return util::Error{
strprintf(
_(
"Unsupported category-specific logging level %1$s=%2$s. Expected %1$s=<category>:<loglevel>. Valid categories: %3$s. Valid loglevels: %4$s."),
"-loglevel", level_str,
LogInstance().LogCategoriesString(),
LogInstance().LogLevelsString())};
87 const std::vector<std::string> categories =
args.
GetArgs(
"-debug");
89 if (std::none_of(categories.begin(), categories.end(),
90 [](std::string cat){
return cat ==
"0" || cat ==
"none";})) {
91 for (
const auto& cat : categories) {
100 for (
const std::string& cat :
args.
GetArgs(
"-debugexclude")) {
149 version_string +=
" (debug build)";
151 version_string +=
" (release build)";
void EnableCategory(LogFlags flag)
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...
fs::path GetPathArg(std::string arg, const fs::path &default_value={}) const
Return path argument or default value.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
BCLog::Logger & LogInstance()
fs::path GetConfigFilePath() const
Return config file path (read-only)
void SetCategoryLogLevel(const std::unordered_map< LogFlags, Level > &levels)
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
util::Result< void > SetLoggingLevel(const ArgsManager &args)
void AddHiddenArgs(const std::vector< std::string > &args)
Add many hidden arguments.
static const bool DEFAULT_LOGTHREADNAMES
util::Result< void > SetLoggingCategories(const ArgsManager &args)
static const bool DEFAULT_LOGTIMEMICROS
std::string FormatISO8601DateTime(int64_t nTime)
ISO 8601 formatting is preferred.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void InitWarning(const bilingual_str &str)
Show warning message.
std::vector< std::string > SplitString(std::string_view str, char sep)
bool m_log_sourcelocations
constexpr auto DEFAULT_LOG_LEVEL
disallow -foo syntax that doesn't assign any value
bool IsArgNegated(const std::string &strArg) const
Return true if the argument was originally passed as a negated option, i.e.
static std::string PathToString(const path &path)
Convert path object to a byte string.
bool InitError(const bilingual_str &str)
Show error message.
bilingual_str _(const char *psz)
Translation function.
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
bool StartLogging(const ArgsManager &args)
void DisableCategory(LogFlags flag)
void SetLogLevel(Level level)
void SetLoggingOptions(const ArgsManager &args)
void AddLoggingArgs(ArgsManager &argsman)
std::string FormatFullVersion()
fs::path GetDefaultDataDir()
static const bool DEFAULT_LOGSOURCELOCATIONS
void LogArgs() const
Log the config file options and the command line arguments, useful for troubleshooting.
static const bool DEFAULT_LOGIPS
std::vector< std::string > GetArgs(const std::string &strArg) const
Return a vector of strings of the given argument.
static bool exists(const path &p)
int64_t GetTime()
DEPRECATED, see GetTime.
const char *const DEFAULT_DEBUGLOGFILE
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
static const bool DEFAULT_LOGTIMESTAMPS
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.