/usr/share/perl5/Log/Any/Test.pm is in liblog-any-perl 1.038-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | use 5.008001;
use strict;
use warnings;
package Log::Any::Test;
# ABSTRACT: Test what you're logging with Log::Any
our $VERSION = '1.038';
no warnings 'once';
$Log::Any::OverrideDefaultAdapterClass = 'Log::Any::Adapter::Test';
$Log::Any::OverrideDefaultProxyClass = 'Log::Any::Proxy::Test';
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Log::Any::Test - Test what you're logging with Log::Any
=head1 VERSION
version 1.038
=head1 SYNOPSIS
use 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'}, ...]);
=head1 DESCRIPTION
C<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
L<Log::Any::Dispatch|Log::Any::Dispatch>.
Using C<Log::Any::Test> sends all subsequent Log::Any log messages to a single
global in-memory buffer. It should be used before L<Log::Any|Log::Any>.
=head1 NAME
Log::Any::Test - Test what you're logging with Log::Any
=head1 VERSION
version 1.038
=head1 METHODS
The test_name is optional in the *_ok methods; a reasonable default will be
provided.
=over
=item msgs ()
Returns the current contents of the global log buffer as an array reference,
where each element is a hash containing a I<category>, I<level>, and I<message>
key. e.g.
{
category => 'Foo',
level => 'error',
message => 'this is an error'
},
{
category => 'Bar::Baz',
level => 'debug',
message => 'this is a debug'
}
=item contains_ok ($regex[, $test_name])
Tests that a message in the log buffer matches I<$regex>. On success, the
message is I<removed> from the log buffer (but any other matches are left
untouched).
=item does_not_contain_ok ($regex[, $test_name])
Tests that no message in the log buffer matches I<$regex>.
=item category_contains_ok ($category, $regex[, $test_name])
Tests that a message in the log buffer from a specific category matches
I<$regex>. On success, the message is I<removed> from the log buffer (but any
other matches are left untouched).
=item category_does_not_contain_ok ($category, $regex[, $test_name])
Tests that no message from a specific category in the log buffer matches
I<$regex>.
=item empty_ok ([$test_name])
Tests that there is no log buffer left. On failure, the log buffer is cleared
to limit further cascading failures.
=item contains_only_ok ($regex[, $test_name])
Tests that there is a single message in the log buffer and it matches
I<$regex>. On success, the message is removed.
=item clear ()
Clears the log buffer.
=back
=head1 SEE ALSO
L<Log::Any|Log::Any>, L<Test::Log::Dispatch|Test::Log::Dispatch>
=head1 AUTHORS
=over 4
=item *
Jonathan Swartz <swartz@pobox.com>
=item *
David Golden <dagolden@cpan.org>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Jonathan Swartz and David Golden.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 AUTHORS
=over 4
=item *
Jonathan Swartz <swartz@pobox.com>
=item *
David Golden <dagolden@cpan.org>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Jonathan Swartz and David Golden.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|