Dave Rolsky > Log-Dispatch-2.36 > Log::Dispatch::Output

Download:
Log-Dispatch-2.36.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  7
Open  5
View/Report Bugs
Module Version: 2.36   Source   Latest Release: Log-Dispatch-2.41

NAME ^

Log::Dispatch::Output - Base class for all Log::Dispatch::* objects

VERSION ^

version 2.36

SYNOPSIS ^

  package Log::Dispatch::MySubclass;

  use Log::Dispatch::Output;
  use base qw( Log::Dispatch::Output );

  sub new {
      my $proto = shift;
      my $class = ref $proto || $proto;

      my %p = @_;

      my $self = bless {}, $class;

      $self->_basic_init(%p);

      # Do more if you like

      return $self;
  }

  sub log_message {
      my $self = shift;
      my %p    = @_;

      # Do something with message in $p{message}
  }

  1;

DESCRIPTION ^

This module is the base class from which all Log::Dispatch::* objects should be derived.

CONSTRUCTOR ^

The constructor, new, must be overridden in a subclass. See Output Classes for a description of the common parameters accepted by this constructor.

METHODS ^

Subclassing

This class should be used as the base class for all logging objects you create that you would like to work under the Log::Dispatch architecture. Subclassing is fairly trivial. For most subclasses, if you simply copy the code in the SYNOPSIS and then put some functionality into the log_message method then you should be all set. Please make sure to use the _basic_init method as directed.

The actual logging implementation should be done in a log_message method that you write. Do not override log!.

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2011 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: