From 9694510adfb97e7c80112857fa2daa1ad234d336 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Thu, 16 Dec 2010 15:36:12 -0500 Subject: [PATCH] make the logger a little bit more functional --- Crypt/Monkeysphere/MSVA/Logger.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Crypt/Monkeysphere/MSVA/Logger.pm b/Crypt/Monkeysphere/MSVA/Logger.pm index ab981a4..eae0df0 100644 --- a/Crypt/Monkeysphere/MSVA/Logger.pm +++ b/Crypt/Monkeysphere/MSVA/Logger.pm @@ -55,6 +55,25 @@ return $self->{loglevel}; } + sub set_log_level { + my $self = shift; + my $loglevel = shift; + my $logval = $loglevels{lc($loglevel)}; + + if (defined($logval)) { + $self->{loglevel} = $logval; + } else { + $self->log('error', "Invalid log level: '%s' (log level not changed)\n", $loglevel); + } + } + sub more_verbose { + my $self = shift; + my $increment = shift; + + $increment = 1 + if (!defined $increment); + $self->{loglevel} += $increment; + } # let the user test to see if we're noisier than this level # directly: -- 2.26.2