man Courier::Filter::Logger () - An abstract Perl base class for loggers used by the Courier::Filter framework

NAME

Courier::Filter::Logger - An abstract Perl base class for loggers used by the Courier::Filter framework

VERSION

0.16

SYNOPSIS

Courier::Filter logging

    use Courier::Filter::Logger::My;  # Need to use a non-abstract sub-class.

    my $logger = Courier::Filter::Logger::My->new(%options);

    # For use in an individual filter module:
    my $module = Courier::Filter::Module::My->new(
        ...
        logger => $logger,
        ...
    );

    # For use as a global Courier::Filter logger object:
    my $filter = Courier::Filter->new(
        ...
        logger => $logger,
        ...
    );

Deriving new logger classes

    package Courier::Filter::Logger::My;
    use base qw(Courier::Filter::Logger);

DESCRIPTION

Sub-classes of Courier::Filter::Logger are used by the Courier::Filter mail filtering framework and its filter modules for the logging of errors and message rejections to arbitrary targets, like file handles or databases.

When overriding a method in a derived class, do not forget calling the inherited method from your overridden method.

Constructor

The following constructor is provided and may be overridden:

new(%options): RETURNS Courier::Filter::Logger (or derivative)
Creates a new logger using the CW%options given as a list of key/value pairs. Initializes the logger, by creating/opening I/O handles, connecting to databases, etc.. CWCourier::Filter::Logger::new() creates a hashref as an object of the invoked class, and stores the CW%options in it, but does nothing else.

Destructor

The following destructor is provided and may be overridden:

destroy
Uninitializes the logger, by closing I/O handles, disconnecting from databases, etc.. CWCourier::Filter::Logger::destroy() does nothing.

Instance methods

The following instance methods are provided and may be overridden:

log_error($text)
Logs the error message given as CW$text (a string which may contain newlines). CWCourier::Filter::Logger::log_error() does nothing and should be overridden. Logs the Courier::Message given as CW$message as having been rejected due to CW$reason (a string which may contain newlines). CWCourier::Filter::Logger::log_rejected_message() does nothing and should be overridden.

SEE ALSO

Courier::Filter, Courier::Filter::Module.

For a list of prepared loggers that come with Courier::Filter, see Bundled Courier::Filter loggers in Courier::Filter::Overview.

For AVAILABILITY, SUPPORT, and LICENSE information, see Courier::Filter::Overview.

AUTHOR

Julian Mehnle <julian@mehnle.net>