NAME
Log::Dispatch::XML - Collect one or more messages in XML format
SYNOPSIS
use Log::Dispatch::XML ();
my $dispatcher = Log::Dispatch->new;
my $channel = Log::Dispatch::XML->new(
name => 'foo',
min_level => 'info',
) );
$dispatcher->add( $channel );
$dispatcher->warning( "This is a warning" );
my $xml = $channel->xml;
# <messages><warning><![CDATA[This is a warning]]></warning></messages>
DESCRIPTION
The "Log::Dispatch::XML" module offers a buffering logging alternative for XML users. Messages are collected in the output channel until XML is created from them.
ADDITIONAL METHODS
Apart from the methods provided by Log::Dispatch::Buffer (and implicitely from Log::Dispatch::Output), the following method is available:
xml
$xml = $channel->xml;
$xml = $channel->xml( qq{log:messages xmlns:log="http://foo.com"} );
Return the XML of the messages collected on that channel. Two optional input parameters can be provided:
- 1 outer container
-
The name + attributes of the outer container that should be used to generate the XML. By default, "messages" will be assumed.
- 2 inhibit flush
-
By default, once XML is generated from the messages, the messages are flushed from the output channel. Specifying a true value causes the messages not to be flushed.
XML FORMAT
The XML format that is generated is very simple. The name and the attributes of the outer container is (implicitely) specified with the call to "xml". Inside this container, there is one container for each message: the name of that container is the same as the level of the message. The content of the container, is the text of the message. To ensure well-formedness of XML, the message is put inside a CDATA section.
REQUIRED MODULES
Log::Dispatch (1.16)
Log::Dispatch::Buffer (any)
AUTHOR
Elizabeth Mattijsen, <liz@dijkmat.nl>.
maintained by LNATION, <thisusedtobeanemail@gmail.com>
Please report bugs to <perlbugs@dijkmat.nl>.
COPYRIGHT
Copyright (c) 2004 Elizabeth Mattijsen <liz@dijkmat.nl>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.