From e95f1e294e4f0c6b3b14681f16107d48e696aa2e Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Tue, 2 Dec 2014 17:13:00 -0600 Subject: [PATCH] Add method to exclude messages from content log --- plugins/content_log | 8 ++++++++ t/plugin_tests/content_log | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/plugins/content_log b/plugins/content_log index 6b884ea..c6c43ae 100644 --- a/plugins/content_log +++ b/plugins/content_log @@ -14,6 +14,9 @@ sub register { sub data_post_handler { my ($self, $transaction) = @_; + return DECLINED, 'excluded from content logging' + if $self->exclude(); + open my $out, '>>', $self->content_log_file or return DECLINED, "Could not open log file.. continuing anyway"; @@ -41,3 +44,8 @@ sub content_log_enabled { return 1 if lc($enabled) eq 'true'; return 0; } + +sub exclude { + # override this method to exclude some messages from content logging + return 0; +} diff --git a/t/plugin_tests/content_log b/t/plugin_tests/content_log index a4ea0d9..cac14fa 100644 --- a/t/plugin_tests/content_log +++ b/t/plugin_tests/content_log @@ -7,6 +7,7 @@ sub register_tests { my ( $self ) = @_; $self->register_test('test_content_log_file'); $self->register_test('test_content_log_enabled'); + $self->register_test('test_exclude'); } sub test_content_log_file { @@ -19,3 +20,8 @@ sub test_content_log_enabled { ok( ! $self->content_log_enabled, 'content_log_enabled() returns false' ); } +sub test_exclude { + my ( $self ) = @_; + ok( ! $self->exclude, 'exclude() default method returns false' ); +} +