Fix required argument for --debug|-x.

Refs #6276
This commit is contained in:
Michael Friedrich 2014-05-23 14:12:55 +02:00
parent 4cf293837f
commit 09f3040bae
2 changed files with 10 additions and 5 deletions

View File

@ -830,7 +830,7 @@ for historical reasons.
-D [ --define] args define a constant
-c [ --config ] arg parse a configuration file
-C [ --validate ] exit after validating the configuration
-x [ --debug ] arg enable debugging with optional severity level specified
-x [ --debug ] arg enable debugging with severity level specified
-d [ --daemonize ] detach from the controlling terminal
-e [ --errorlog ] arg log fatal errors to the specified log file (only works
in combination with --daemonize)

View File

@ -334,7 +334,7 @@ int Main(void)
("config,c", po::value<std::vector<std::string> >(), "parse a configuration file")
("no-config,z", "start without a configuration file")
("validate,C", "exit after validating the configuration")
("debug,x", po::value<std::string>(), "enable debugging with optional severity level specified")
("debug,x", po::value<std::string>(), "enable debugging with severity level specified")
("errorlog,e", po::value<std::string>(), "log fatal errors to the specified log file (only works in combination with --daemonize)")
#ifndef _WIN32
("reload-internal", po::value<int>(), "used internally to implement config reload: do not call manually, send SIGHUP instead")
@ -431,10 +431,15 @@ int Main(void)
if (g_AppParams.count("debug")) {
Application::SetDebugging(true);
String debug_severity = g_AppParams["debug"].as<std::string>();
LogSeverity debug_severity;
try {
debug_severity = Logger::StringToSeverity(g_AppParams["debug"].as<std::string>());
} catch (std::exception&) {
//not set, use default
debug_severity = LogDebug;
}
if (!debug_severity.IsEmpty())
Application::SetDebuggingSeverity(Logger::StringToSeverity(debug_severity));
Application::SetDebuggingSeverity(debug_severity);
}
if (g_AppParams.count("help") || g_AppParams.count("version")) {