aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-16 17:03:36 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-16 17:03:36 +0000
commit760ae661062cf534fd535d98c0cedd47e72cfa54 (patch)
treebd17f7bff07c65f3c16c192a79edbbe4cfa0a91b
parent00d10b6f7874266c7f0635ebb5c11479a6b0b111 (diff)
downloadpaludis-760ae661062cf534fd535d98c0cedd47e72cfa54.tar.gz
paludis-760ae661062cf534fd535d98c0cedd47e72cfa54.tar.xz
Add --log-level, default to warning
-rw-r--r--src/qualudis/qualudis.cc11
-rw-r--r--src/qualudis/qualudis_command_line.cc7
-rw-r--r--src/qualudis/qualudis_command_line.hh3
3 files changed, 20 insertions, 1 deletions
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 7fabcdc..8afc1f5 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -273,6 +273,17 @@ int main(int argc, char *argv[])
QualudisCommandLine::get_instance()->a_describe.specified()))
throw DoHelp("you should specify exactly one action");
+ if (! QualudisCommandLine::get_instance()->a_log_level.specified())
+ Log::get_instance()->set_log_level(ll_warning);
+ else if (QualudisCommandLine::get_instance()->a_log_level.argument() == "debug")
+ Log::get_instance()->set_log_level(ll_debug);
+ else if (QualudisCommandLine::get_instance()->a_log_level.argument() == "warning")
+ Log::get_instance()->set_log_level(ll_warning);
+ else if (QualudisCommandLine::get_instance()->a_log_level.argument() == "silent")
+ Log::get_instance()->set_log_level(ll_silent);
+ else
+ throw DoHelp("bad value for --log-level");
+
if (QualudisCommandLine::get_instance()->a_version.specified())
throw DoVersion();
diff --git a/src/qualudis/qualudis_command_line.cc b/src/qualudis/qualudis_command_line.cc
index cc07b36..4401a3a 100644
--- a/src/qualudis/qualudis_command_line.cc
+++ b/src/qualudis/qualudis_command_line.cc
@@ -29,7 +29,12 @@ QualudisCommandLine::QualudisCommandLine() :
a_help(&action_args, "help", 'h', "Display program help"),
check_options(this, "Options for --check"),
- a_verbose(&check_options, "verbose", 'v', "Be verbose")
+ a_verbose(&check_options, "verbose", 'v', "Be verbose"),
+ a_log_level(&check_options, "log-level", 'L', "Specify the log level",
+ paludis::args::EnumArg::EnumArgOptions("debug", "Show debug output (noisy)")
+ ("warning", "Show warnings only")
+ ("silent", "Suppress all log messages"),
+ "warning")
{
}
diff --git a/src/qualudis/qualudis_command_line.hh b/src/qualudis/qualudis_command_line.hh
index 2b58c88..7f4c8c1 100644
--- a/src/qualudis/qualudis_command_line.hh
+++ b/src/qualudis/qualudis_command_line.hh
@@ -49,6 +49,9 @@ class QualudisCommandLine :
/// --verbose
paludis::args::SwitchArg a_verbose;
+ /// --log-level
+ paludis::args::EnumArg a_log_level;
+
///}
};