The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Log::Dispatch::Atom - Log to an atom feed.

VERSION

This document describes Log::Dispatch::Atom version 0.01

SYNOPSIS

    use Log::Dispatch::Atom;

    my $log = Log::Dispatch::Atom->new(
        name      => 'foo',
        min_level => 'debug',
        file      => 'file.atom'
    );
    $log->log_message( level => 'error', message => 'A problem happened' );
    $log->log_message( level => 'debug', message => 'Got Here' );

DESCRIPTION

This class implements logging backed by an Atom feed so that you can subscribe to the errors produced by your application.

You should not use this object directly, but should manage it via a Log::Dispatch object.

IMPLEMENTATION NOTES

In order to safely write to the log file, the entire file must be locked each time that an entry is logged. This probably makes it unsuitable for high volume log files.

The log file is opened and closed on each call to log_message().

METHODS

new()

Takes a hash of arguments. Returns a new Log::Dispatch::Atom object. The following parameters are used:

name [mandatory]

The name of the logging object.

min_level [mandatory]

The minimum logging level this object will accept. See Log::Dispatch for more information.

max_level [optional]

The maximum logging level this object will accept. See Log::Dispatch for more information. The default is the highest possible level (ie: no maximum).

file [mandatory]

Specifies the location of the file to read/write the feed from.

feed_id [optional]

Specifies the identity of the feed itself. Normally, this should be set to the published URI of the feed.

If not specified, it will be omitted, which is in violation of the Atom specification. For more information, see http://www.atomenabled.org/developers/syndication/#requiredFeedElements.

feed_title [optional]

The title of the feed. This should probably be set to the name of your application.

If not specified, it will be omitted, which is in violation of the Atom specification. For more information, see http://www.atomenabled.org/developers/syndication/#requiredFeedElements.

XXX This should probably just use the name parameter.

log_message()

Takes a hash of arguments. Has no return value. The following parameters are used.

message [mandatory]

The actual log message.

level [mandatory]

The level of the message. See Log::Dispatch for a full list.

SEE ALSO

XML::Atom, the module used for Atom processing.

The spec for the atom syndication format, http://www.atomenabled.org/developers/syndication/.

DEPENDENCIES

XML::Atom version 0.15.

This module uses flock() to the lock the feed file whilst it's writing, so your version of Perl will need support for that.

BUGS AND LIMITATIONS

Please report any bugs or feature requests to bug-xml-atom-log@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Dominic Mitchell <cpan (at) happygiraffe.net>

LICENCE AND COPYRIGHT

Copyright (c) 2005, Dominic Mitchell <cpan (at) happygiraffe.net>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.