Skip to content

Commit

Permalink
Add support for --verbose and --VERBOSE with standard long opt format.
Browse files Browse the repository at this point in the history
ELPP will now support --verbose which will set maximum verbosity or with
a specified level (both in short and long option form):
  * --v=2
  * --verbose=2
  * --verbose (sets verbosity to 9)

Fixes abumq#823
  • Loading branch information
jshort committed Oct 19, 2022
1 parent 8489989 commit c424277
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/easylogging++.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2041,13 +2041,17 @@ bool VRegistry::allowed(base::type::VerboseLevel vlevel, const char* file) {
}

void VRegistry::setFromArgs(const base::utils::CommandLineArgs* commandLineArgs) {
if (commandLineArgs->hasParam("-v") || commandLineArgs->hasParam("--verbose") ||
commandLineArgs->hasParam("-V") || commandLineArgs->hasParam("--VERBOSE")) {
setLevel(base::consts::kMaxVerboseLevel);
if (commandLineArgs->hasParamWithValue("--verbose")) {
setLevel(static_cast<base::type::VerboseLevel>(atoi(commandLineArgs->getParamValue("--verbose"))));
} else if (commandLineArgs->hasParamWithValue("--VERBOSE")) {
setLevel(static_cast<base::type::VerboseLevel>(atoi(commandLineArgs->getParamValue("--VERBOSE"))));
} else if (commandLineArgs->hasParamWithValue("--v")) {
setLevel(static_cast<base::type::VerboseLevel>(atoi(commandLineArgs->getParamValue("--v"))));
} else if (commandLineArgs->hasParamWithValue("--V")) {
setLevel(static_cast<base::type::VerboseLevel>(atoi(commandLineArgs->getParamValue("--V"))));
} else if (commandLineArgs->hasParam("-v") || commandLineArgs->hasParam("--verbose") ||
commandLineArgs->hasParam("-V") || commandLineArgs->hasParam("--VERBOSE")) {
setLevel(base::consts::kMaxVerboseLevel);
} else if ((commandLineArgs->hasParamWithValue("-vmodule")) && vModulesEnabled()) {
setModules(commandLineArgs->getParamValue("-vmodule"));
} else if (commandLineArgs->hasParamWithValue("-VMODULE") && vModulesEnabled()) {
Expand Down

0 comments on commit c424277

Please sign in to comment.