aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-03-07 06:26:52 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-03-07 06:26:52 +0000
commit37adc6c0fefaef1b2d130f50667d9c348e8b1f65 (patch)
tree3190c67b9509c6c9cbf91d9b5e5c744f069c3498
parent607aa4a4373e79e1a68d8d4fa519bd5fd50edfd6 (diff)
downloadpaludis-37adc6c0fefaef1b2d130f50667d9c348e8b1f65.tar.gz
paludis-37adc6c0fefaef1b2d130f50667d9c348e8b1f65.tar.xz
Add log-level, default to not showing debug messages for paludis
-rw-r--r--src/command_line.cc5
-rw-r--r--src/command_line.hh3
-rw-r--r--src/paludis.cc13
3 files changed, 21 insertions, 0 deletions
diff --git a/src/command_line.cc b/src/command_line.cc
index 728d32a..8639315 100644
--- a/src/command_line.cc
+++ b/src/command_line.cc
@@ -32,6 +32,11 @@ CommandLine::CommandLine() :
a_help(&action_args, "help", 'h', "Display program help"),
general_args(this, "General options"),
+ a_log_level(&general_args, "log-level", '\0', "Specify the log level",
+ paludis::args::EnumArg::EnumArgOptions("debug", "Show debug output (noisy)")
+ ("warning", "Show warnings only")
+ ("silent", "Suppress all log messages"),
+ "warning"),
a_no_colour(&general_args, "no-colour", 'c', "Do not use colour"),
a_no_color(&a_no_colour, "no-color"),
diff --git a/src/command_line.hh b/src/command_line.hh
index 5beffb8..9a47b6d 100644
--- a/src/command_line.hh
+++ b/src/command_line.hh
@@ -79,6 +79,9 @@ class CommandLine :
/// General arguments.
paludis::args::ArgsGroup general_args;
+ /// --log-level
+ paludis::args::EnumArg a_log_level;
+
/// --no-colour
paludis::args::SwitchArg a_no_colour;
diff --git a/src/paludis.cc b/src/paludis.cc
index 19799b3..f7b04e9 100644
--- a/src/paludis.cc
+++ b/src/paludis.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/paludis.hh>
+#include <paludis/util/util.hh>
#include "src/query.hh"
#include "src/install.hh"
#include "src/list.hh"
@@ -66,6 +67,18 @@ main(int argc, char *argv[])
if (CommandLine::get_instance()->a_help.specified())
throw DoHelp();
+ if (! CommandLine::get_instance()->a_log_level.specified())
+ p::Log::get_instance()->set_log_level(p::ll_warning);
+ else if (CommandLine::get_instance()->a_log_level.argument() == "debug")
+ p::Log::get_instance()->set_log_level(p::ll_debug);
+ else if (CommandLine::get_instance()->a_log_level.argument() == "warning")
+ p::Log::get_instance()->set_log_level(p::ll_warning);
+ else if (CommandLine::get_instance()->a_log_level.argument() == "silent")
+ p::Log::get_instance()->set_log_level(p::ll_silent);
+ else
+ throw DoHelp("bad value for --log-level");
+
+
if (1 != (CommandLine::get_instance()->a_query.specified() +
CommandLine::get_instance()->a_version.specified() +
CommandLine::get_instance()->a_install.specified() +