From: Daniel Kahn Gillmor Date: Thu, 16 Dec 2010 20:36:12 +0000 (-0500) Subject: make the logger a little bit more functional X-Git-Tag: msva-perl_debian/0.7-1~3^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9694510adfb97e7c80112857fa2daa1ad234d336;p=monkeysphere-validation-agent.git make the logger a little bit more functional --- 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: