From 50badecc48c7241ca44bdc3b35c1b03cf5c08f6a Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Tue, 2 Dec 2014 16:28:51 -0600 Subject: [PATCH] Split out content log file name logic --- plugins/content_log | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/content_log b/plugins/content_log index b4f04c4..48f1567 100644 --- a/plugins/content_log +++ b/plugins/content_log @@ -8,9 +8,7 @@ use POSIX qw:strftime:; sub hook_data_post { my ($self, $transaction) = @_; - # as a decent default, log on a per-day-basis - my $date = strftime("%Y%m%d", localtime(time)); - open(my $out, ">>mail/$date") + open my $out, '>>', $self->content_log_file; or return DECLINED, "Could not open log file.. continuing anyway"; $transaction->header->print($out); @@ -23,3 +21,9 @@ sub hook_data_post { 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"; +}