]> diplodocus.org Git - minc/commitdiff
Stop logging.
authorepg@google.com <>
Tue, 3 Dec 2013 20:40:34 +0000 (12:40 -0800)
committerepg@google.com <>
Tue, 3 Dec 2013 20:40:34 +0000 (12:40 -0800)
In 11 years, I've never needed the log.  I have often moved files from mh folder
back to Maildir and rerun as I developed a filter.

Probably this log made sense before I added the scan-esque status line for
each message at 2005-09-02 22:36:10 +0000 .  So this has been redundant for
over 8 years.  Nice.

minc

diff --git a/minc b/minc
index 14964500a0dd9a3adeffd735c040eac19a752fd9..1642c46ec6f8dd0e06ac94422d0527ac09e4ca41 100755 (executable)
--- a/minc
+++ b/minc
@@ -44,7 +44,6 @@ use FileHandle;
 use File::Temp qw(tempfile);
 use File::stat;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case);
-use POSIX qw(strftime WEXITSTATUS WIFEXITED);
 use Pod::Usage;
 
 our $VERSION = 1;
@@ -156,10 +155,6 @@ may define the FILTERS list, @start_hooks, @filter_hooks,
 B<minc> adds all folders it filters into to this file, which is used
 by lukem's B<new(1)> (XXX need a link).
 
-=item `mhpath +`/logs/minc.log
-
-Where B<minc> logs what it does, unless in -n mode.
-
 =item `mhpath +`/.minc.context
 
 B<minc> uses this file for context (i.e. current folder) instead of
@@ -188,56 +183,8 @@ my $mh;
 $mh = `mhpath +`;
 chomp($mh);
 
-my $logfile = $mh . '/logs/minc.log';
-
 $ENV{"MHCONTEXT"} = $mh . '/.minc.context';
 
-\f
-###############################################################################
-# Logging
-
-sub mylog {
-    $run or return;
-
-    my $timestamp = strftime('%b %e %H:%M:%S', localtime);
-    my $msg;
-    foreach my $part (@_) {
-        if (defined($part)) {
-            $msg .= $part;
-        }
-    }
-    # no newlines in the log message, thanks
-    $msg =~ s/\n/ /gm;
-
-    open(LOG, ">>$logfile") or die("open(>>$logfile): $!");
-    print(LOG "$timestamp $msg\n") or die("print(>>$logfile): $!");
-    close(LOG) or die("close($logfile): $!");
-}
-
-sub logheader {
-    my ($text, @contents) = @_;
-    my $last;
-
-    if (@contents) {
-        $last = $contents[-1];
-    } else {
-        $last = '';
-    }
-
-    mylog('<< ', $text, $last);
-}
-
-sub log_headers {
-    my %headers = %{(shift)};
-
-    # For an explanation of the %headers structure, see the
-    # get_headers function below.
-    logheader('From:       ', @{$headers{'return-path'}});
-    logheader('To:         ', @{$headers{'to'}});
-    logheader('Subject:    ', @{$headers{'subject'}});
-    logheader('Message-Id: ', @{$headers{'message-id'}});
-}
-
 \f
 ###############################################################################
 # Utility procedures
@@ -472,8 +419,6 @@ sub store_message {
         #sleep(2);
     }
 
-    mylog('+', $mhfolder);
-
     if ($run) {
         if (not rename($msg, $mhmsg)) {
             die("rename($msg, $mhmsg): $!");
@@ -662,7 +607,6 @@ sub filter_mail {
         ($msg eq '.' or $msg eq '..') and next;
 
         my $headers = get_headers($msg);
-        log_headers($headers);
 
         undef($mhfolder);
         for my $hook (@filter_hooks) {