Split out content log file name logic

This commit is contained in:
Jared Johnson 2014-12-02 16:28:51 -06:00
parent df2ef1cb64
commit 50badecc48

View File

@ -8,9 +8,7 @@ use POSIX qw:strftime:;
sub hook_data_post { sub hook_data_post {
my ($self, $transaction) = @_; my ($self, $transaction) = @_;
# as a decent default, log on a per-day-basis open my $out, '>>', $self->content_log_file;
my $date = strftime("%Y%m%d", localtime(time));
open(my $out, ">>mail/$date")
or return DECLINED, "Could not open log file.. continuing anyway"; or return DECLINED, "Could not open log file.. continuing anyway";
$transaction->header->print($out); $transaction->header->print($out);
@ -23,3 +21,9 @@ sub hook_data_post {
return DECLINED, "successfully saved message.. continuing"; return DECLINED, "successfully saved message.. continuing";
} }
sub content_log_file {
# as a decent default, log on a per-day-basis
my $date = strftime("%Y%m%d", localtime(time));
return "mail/$date";
}