Command line option to not log to console after startup

This commit is contained in:
Mark Travis
2015-12-10 07:51:01 -08:00
committed by Nik Bougalis
parent d17c8e235f
commit f26835e507
5 changed files with 22 additions and 2 deletions

View File

@@ -926,6 +926,8 @@ void ApplicationImp::setup()
logs_->severity (beast::Journal::kDebug);
}
logs_->silent (config_->SILENT);
if (!config_->RUN_STANDALONE)
timeKeeper_->run(config_->SNTP_SERVERS);

View File

@@ -271,6 +271,7 @@ int run (int argc, char** argv)
("parameters", po::value< vector<string> > (), "Specify comma separated parameters.")
("quiet,q", "Reduce diagnotics.")
("quorum", po::value <int> (), "Set the validation quorum.")
("silent", "No output to the console after startup.")
("verbose,v", "Verbose logging.")
("load", "Load the current ledger from the local DB.")
("valid", "Consider the initial ledger a valid network ledger.")
@@ -355,6 +356,9 @@ int run (int argc, char** argv)
// config file, quiet flag.
config->setup (configFile, bool (vm.count ("quiet")));
if (vm.count ("silent"))
config->SILENT = true;
if (vm.count ("standalone"))
{
config->RUN_STANDALONE = true;

View File

@@ -148,6 +148,7 @@ private:
std::map <std::string, Sink, beast::ci_less> sinks_;
beast::Journal::Severity level_;
File file_;
bool silent_ = false;
public:
Logs();
@@ -183,6 +184,17 @@ public:
std::string
rotate();
/**
* Set flag to write logs to stderr (false) or not (true).
*
* @param bSilent Set flag accordingly.
*/
void
silent (bool bSilent)
{
silent_ = bSilent;
}
public:
static
LogSeverity

View File

@@ -176,6 +176,7 @@ Logs::write (beast::Journal::Severity level, std::string const& partition,
format (s, text, level, partition);
std::lock_guard <std::mutex> lock (mutex_);
file_.writeln (s);
if (! silent_)
std::cerr << s << '\n';
// VFALCO TODO Fix console output
//if (console)

View File

@@ -160,7 +160,8 @@ public:
beast::File getModuleDatabasePath () const;
bool doImport = false;
bool QUIET = false;
bool QUIET = false; // Minimize logging verbosity.
bool SILENT = false; // No output to console after startup.
bool ELB_SUPPORT = false;
std::string VALIDATORS_SITE; // Where to find validators.txt on the Internet.