From: epg@google.com <> Date: Tue, 3 Dec 2013 20:40:34 +0000 (-0800) Subject: Stop logging. X-Git-Url: https://diplodocus.org/git/minc/commitdiff_plain/bad0697ce9267f72739beea39ac3e76d96af5dc3?hp=f0ef05d5bea74ec19224fd236a0787d4b1aff29b Stop logging. 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. --- diff --git a/minc b/minc index 1496450..1642c46 100755 --- 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 adds all folders it filters into to this file, which is used by lukem's B (XXX need a link). -=item `mhpath +`/logs/minc.log - -Where B logs what it does, unless in -n mode. - =item `mhpath +`/.minc.context B 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'; - -############################################################################### -# 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'}}); -} - ############################################################################### # 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) {