Report an error if the user forgets to pass an argument to --trace.
This commit is contained in:
parent
aa4f0d4364
commit
e41dbc204a
1 changed files with 8 additions and 1 deletions
9
main.cc
9
main.cc
|
|
@ -373,7 +373,14 @@ int main(int argc, char * argv[], char * envp[])
|
|||
else if (i + 1 < argc && std::strcmp(argv[i], "--trace") == 0) {
|
||||
#if defined(TRACING_ON)
|
||||
ledger::_log_level = ledger::LOG_TRACE;
|
||||
ledger::_trace_level = boost::lexical_cast<int>(argv[i + 1]);
|
||||
try {
|
||||
ledger::_trace_level = boost::lexical_cast<int>(argv[i + 1]);
|
||||
}
|
||||
catch (const boost::bad_lexical_cast& e) {
|
||||
std::cerr << "Argument to --trace must be an integer."
|
||||
<< std::endl;
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue