Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5564 from twinstar26/master
Browse files Browse the repository at this point in the history
Add log channels to Aleth command-line help output
  • Loading branch information
gumb0 committed Apr 17, 2019
2 parents aecf6c9 + b9a6f02 commit 9b511f2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Added: [#5537](https://github.com/ethereum/aleth/pull/5537) Creating Ethereum Node Record (ENR) at program start.
- Added: [#5557](https://github.com/ethereum/aleth/pull/5557) Improved debug logging of full sync.
- Added: [#5564](https://github.com/ethereum/aleth/pull/5564) Improved help output of Aleth by adding list of channels.
- Changed: [#5559](https://github.com/ethereum/aleth/pull/5559) Update peer validation error messages.
- Fixed: [#5562](https://github.com/ethereum/aleth/pull/5562) Don't send header request messages to peers that haven't sent us Status yet.
- Changed: [#5568](https://github.com/ethereum/aleth/pull/5568) Improve rlpx handshake log messages and create new rlpx log channel.
Expand Down
5 changes: 4 additions & 1 deletion aleth/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,12 @@ int main(int argc, char** argv)
addImportExportOption("import-snapshot", po::value<string>()->value_name("<path>"),
"Import blockchain and state data from the Parity Warp Sync snapshot\n");

std::string const logChannels =
"block blockhdr bq chain client debug discov error ethcap exec host impolite info net "
"overlaydb peer rlpx rpc snap statedb sync timer tq trace vmtrace warn watch";
LoggingOptions loggingOptions;
po::options_description loggingProgramOptions(
createLoggingProgramOptions(c_lineWidth, loggingOptions));
createLoggingProgramOptions(c_lineWidth, loggingOptions, logChannels));

po::options_description generalOptions("GENERAL OPTIONS", c_lineWidth);
auto addGeneralOption = generalOptions.add_options();
Expand Down
9 changes: 7 additions & 2 deletions libdevcore/LoggingProgramOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@ namespace po = boost::program_options;

namespace dev
{
po::options_description createLoggingProgramOptions(unsigned _lineLength, LoggingOptions& _options)
po::options_description createLoggingProgramOptions(
unsigned _lineLength, LoggingOptions& _options, std::string const& _logChannels)
{
po::options_description optionsDescr("LOGGING OPTIONS", _lineLength);
auto addLoggingOption = optionsDescr.add_options();
addLoggingOption("log-verbosity,v", po::value<int>(&_options.verbosity)->value_name("<0 - 4>"),
"Set the log verbosity from 0 to 4 (default: 2).");

std::string const logChannelsDescription =
"Space-separated list of the log channels to show (default: show all channels)." +
(_logChannels.empty() ? "" : "\nChannels: " + _logChannels);
addLoggingOption("log-channels",
po::value<std::vector<std::string>>(&_options.includeChannels)
->value_name("<channel_list>")
->multitoken(),
"Space-separated list of the log channels to show (default: show all channels).");
logChannelsDescription.c_str());
addLoggingOption("log-exclude-channels",
po::value<std::vector<std::string>>(&_options.excludeChannels)
->value_name("<channel_list>")
Expand Down
2 changes: 1 addition & 1 deletion libdevcore/LoggingProgramOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
namespace dev
{
boost::program_options::options_description createLoggingProgramOptions(
unsigned _lineLength, LoggingOptions& _options);
unsigned _lineLength, LoggingOptions& _options, std::string const& _logChannels = {});

} // namespace dev

0 comments on commit 9b511f2

Please sign in to comment.