-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #4918 - Add a -l
/ --loglevel
argument to the labs CLI
#4919
Conversation
auto* const verboseOpt = experimentalApp->add_flag_function( | ||
"--verbose", | ||
[](auto count) { | ||
if (count == 1) { | ||
fmt::print("Setting log Level to Debug\n"); | ||
fmt::print("Setting Log Level to Debug ({})\n", LogLevel::Debug); | ||
openstudio::Logger::instance().standardOutLogger().setLogLevel(LogLevel::Debug); | ||
} else if (count == 2) { | ||
fmt::print("Setting log Level to Trace\n"); | ||
fmt::print("Setting Log Level to Trace ({})\n", LogLevel::Trace); | ||
openstudio::Logger::instance().standardOutLogger().setLogLevel(LogLevel::Trace); | ||
} | ||
}, | ||
"Print the full log to STDOUT"); | ||
"Print the full log to STDOUT - sets verbosity to Debug if given once and Trace if given twice."); |
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 think we should just remove the --verbose
option... instead of having to maintain two excluding options/flags that ultimately achieve the same goal.
@kbenne thoughts please?
src/cli/main.cpp
Outdated
// specify string->value mappings | ||
const std::map<std::string, LogLevel> logLevelMap{ | ||
{"Trace", LogLevel::Trace}, {"Debug", LogLevel::Debug}, {"Info", LogLevel::Info}, | ||
{"Warn", LogLevel::Warn}, {"Error", LogLevel::Error}, {"Fatal", LogLevel::Fatal}, | ||
}; | ||
static constexpr std::array<std::string_view, 6> logLevelStrs = {"Trace", "Debug", "Info", "Warn", "Error", "Fatal"}; | ||
|
||
experimentalApp | ||
->add_option_function<LogLevel>( | ||
"-l,--loglevel", | ||
[](const LogLevel& level) { | ||
fmt::print("Setting log Level to {} ({})\n", logLevelStrs[static_cast<size_t>(level) - static_cast<size_t>(LogLevel::Trace)], level); | ||
openstudio::Logger::instance().standardOutLogger().setLogLevel(level); | ||
}, | ||
"LogLevel settings: One of {Trace, Debug, Info, Warn, Error, Fatal} [Default: Warn] Excludes: --verbose") | ||
->excludes(verboseOpt) | ||
->option_text("LEVEL") | ||
->transform(CLI::CheckedTransformer(logLevelMap, CLI::ignore_case)); |
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.
New option
--verbose Excludes: --loglevel Print the full log to STDOUT - sets verbosity to Debug if given once and Trace if given twice.
-l,--loglevel LEVEL LogLevel settings: One of {Trace, Debug, Info, Warn, Error, Fatal} [Default: Warn] Excludes: --verbose
CI Results for 9743a6b:
|
9743a6b
to
5a4c1a0
Compare
@kbenne I'd still like to know if we can remove the |
…nough" This reverts commit fada36f.
Pull request overview
--verbosity
/--log-level
to the Labs cli #4918Pull Request Author
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.