make the logger a little bit more functional
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 16 Dec 2010 20:36:12 +0000 (15:36 -0500)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 16 Dec 2010 20:36:12 +0000 (15:36 -0500)
Crypt/Monkeysphere/MSVA/Logger.pm

index ab981a4f9c89c590abe87d60ec342f8ce1778584..eae0df0ab6ec3a5e5e195810f46734ae43faa4dd 100644 (file)
 
     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: