Query: log::any::test
OS: debian
Section: 3pm
Links: debian man pages all man pages
Forums: unix linux community forum categories
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
Log::Any::Test(3pm) User Contributed Perl Documentation Log::Any::Test(3pm)NAMELog::Any::Test -- Test what you're logging with Log::AnySYNOPSISuse Test::More; use Log::Any::Test; # should appear before 'use Log::Any'! use Log::Any qw($log); # ... # call something that logs using Log::Any # ... # 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, [{message => 'msg1', level => 'debug'}, ...]);DESCRIPTION"Log::Any::Test" is a simple module that allows you to test what has been logged with Log::Any. Most of its API and implementation have been taken from Log::Any::Dispatch. Using "Log::Any::Test" sends all subsequent Log::Any log messages to a single global in-memory buffer. It should be used before Log::Any.METHODSThe test_name is optional in the *_ok methods; a reasonable default will be provided. msgs () Returns the current contents of the global log buffer as an array reference, where each element is a hash containing a category, level, and message key. e.g. { category => 'Foo', level => 'error', message => 'this is an error' }, { category => 'Bar::Baz', level => 'debug', message => 'this is a debug' } 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.SEE ALSOLog::Any, Test::Log::DispatchAUTHORJonathan 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-12-08 Log::Any::Test(3pm)
Related Man Pages |
---|
log::dispatch::email(3pm) - debian |
log::handler::levels(3pm) - debian |
mojo::log(3pm) - debian |
paranoid::log::buffer(3pm) - debian |
test::log::dispatch(3pm) - debian |
Similar Topics in the Unix Linux Community |
---|
Log files... |
faster way to loop? |
What does this error message mean? |
Console Log in.. |
Log information |