-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add log channels to Aleth command-line help output #5564
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5564 +/- ##
==========================================
- Coverage 62.13% 62.09% -0.05%
==========================================
Files 347 347
Lines 28982 28995 +13
Branches 3284 3284
==========================================
- Hits 18009 18005 -4
- Misses 9796 9810 +14
- Partials 1177 1180 +3 |
@halfalicious @gumb0 Also for xcode there were a ton of warning messages "This was likely caused by different translation units being compiled with different visibility settings." for a long time now. I googled this and nothing serious came out of it. Thought I would let you know. |
@twinstar26 Can you also please add a change log entry? Look at recently merged PRs for examples. |
@halfalicious @gumb0 If everything looks good please let me know so that I can squash the commits. |
This is the improved output message.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a separate function for this, I think this list of channels should be a part of --log-channels
description.
So pass the list of channels to createLoggingProgramOptions
and then add it to log-channels
description after newline.
Kind of like
auto const logChannelsDescription = "Space-separated list of the log channels to show (default: show all channels).\n" + channelList;
addLoggingOption("log-channels",
po::value<std::vector<std::string>>(&_options.includeChannels)
->value_name("<channel_list>")
->multitoken(),
logChannelsDescription);
Then it will be formatted automatically I think.
@gumb0 @halfalicious So with this PR I have created overloaded function Output:-
from aleth-main
|
aleth/main.cpp
Outdated
@@ -202,6 +202,12 @@ int main(int argc, char** argv) | |||
fs::path configPath; | |||
string configJSON; | |||
|
|||
///List_logging_channels | |||
const std::vector <string> list_log_channels = {"block", "blockhdr", "bq", "chain", "client", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see channels like exec
, vmtrace
missing.
Search for all uses of Logger
to find them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I checked all the instances of Logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aleth/main.cpp
Outdated
@@ -202,6 +202,9 @@ int main(int argc, char** argv) | |||
fs::path configPath; | |||
string configJSON; | |||
|
|||
///List_logging_channels | |||
const std::string listLogChannels = "block blockhdr bq chain client debug discov error ethcap exec host impolite info net peer snap sync tq trace vmtrace warn watch"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const std::string listLogChannels = "block blockhdr bq chain client debug discov error ethcap exec host impolite info net peer snap sync tq trace vmtrace warn watch"; | |
std::string const logChannels = "block blockhdr bq chain client debug discov error ethcap exec host impolite info net overlaydb peer rpc snap statedb sync timer tq trace vmtrace warn watch"; |
(some channels were also using clog(...)
way to log, it was hard to find, sorry)
Also move this definition closer to where it's used (right before line 328)
libdevcore/LoggingProgramOptions.cpp
Outdated
@@ -41,4 +41,27 @@ po::options_description createLoggingProgramOptions(unsigned _lineLength, Loggin | |||
return optionsDescr; | |||
} | |||
|
|||
po::options_description createLoggingProgramOptions(unsigned _lineLength, LoggingOptions& _options, const std::string listLogChannels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to duplicate the whole function, you need just this one version and make the last parameter optional.
po::options_description createLoggingProgramOptions(unsigned _lineLength, LoggingOptions& _options, const std::string listLogChannels) | |
po::options_description createLoggingProgramOptions(unsigned _lineLength, LoggingOptions& _options, std::string const& _logChannels = {}) |
Currently help looks like this
|
Fixes #5549