Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

log::dispatch::array(3pm) [debian man page]

Log::Dispatch::Array(3pm)				User Contributed Perl Documentation				 Log::Dispatch::Array(3pm)

NAME
Log::Dispatch::Array - log events to an array (reference) VERSION
version 1.001 SYNOPSIS
use Log::Dispatch; use Log::Dispatch::Array; my $log = Log::Dispatch->new; my $target = []; $log->add(Log::Dispatch::Array->new( name => 'text_table', min_level => 'debug', array => $target, )); $log->warn($_) for @events; # now $target refers to an array of events DESCRIPTION
This provides a Log::Dispatch log output system that appends logged events to an array reference. This is probably only useful for testing the logging of your code. METHODS
"new" my $table_log = Log::Dispatch::Array->new(\%arg); This method constructs a new Log::Dispatch::Array output object. Valid arguments are: array - a reference to an array to append to; defaults to an attr on $table_log array This method returns a reference to the array to which logging is being performed. log_message This is the method which performs the actual logging, as detailed by Log::Dispatch::Output. AUTHOR
Ricardo Signes, "<rjbs@cpan.org>" BUGS
Please report any bugs or feature requests through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. COPYRIGHT
Copyright 2008 Ricardo SIGNES, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2008-04-29 Log::Dispatch::Array(3pm)

Check Out this Related Man Page

Test::Log::Dispatch(3pm)				User Contributed Perl Documentation				  Test::Log::Dispatch(3pm)

NAME
Test::Log::Dispatch -- Test what you are logging SYNOPSIS
use Test::More; use Test::Log::Dispatch; my $log = Test::Log::Dispatch->new(); # ... # call something that logs to $log # ... # now test to make sure you logged the right things $log->contains_ok(qr/good log message/, "good message was logged"); $log->does_not_contain_ok(qr/unexpected log message/, "unexpected message was not logged"); $log->empty_ok("no more logs"); # or my $msgs = $log->msgs; cmp_deeply($msgs, ['msg1', 'msg2', 'msg3']); DESCRIPTION
"Test::Log::Dispatch" is a "Log::Dispatch" object that keeps track of everything logged to it in memory, and provides convenient tests against what has been logged. CONSTRUCTOR
The constructor returns a "Test::Log::Dispatch" object, which inherits from "Log::Dispatch" and contains a single "Log::Dispatch::Array" output at 'debug' level. The constructor requires no parameters. Any parameters will be forwarded to the "Log::Dispatch::Array" constructor. For example, you can pass a min_level to override the default 'debug'. METHODS
The test_name is optional in the *_ok methods; a reasonable default will be provided. contains_ok ($regex[, $test_name]) Tests that a message in the log buffer matches $regex. On success, the message is removed from the log buffer (but any other matches are left untouched). does_not_contain_ok ($regex[, $test_name]) Tests that no message in the log buffer matches $regex. empty_ok ([$test_name]) Tests that there is no log buffer left. On failure, the log buffer is cleared to limit further cascading failures. contains_only_ok ($regex[, $test_name]) Tests that there is a single message in the log buffer and it matches $regex. On success, the message is removed. clear () Clears the log buffer. msgs () Returns the current contents of the log buffer as an array reference, where each element is a hash containing a message and level key. TO DO
o Allow testing of log levels. SEE ALSO
Log::Dispatch, Test::Log4perl AUTHOR
Jonathan Swartz COPYRIGHT &; LICENSE Copyright (C) 2009 Jonathan Swartz, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2009-11-04 Test::Log::Dispatch(3pm)
Man Page