| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Log::Dispatch::TestDiag; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
423939
|
use strict; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
27
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
31
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw(Log::Dispatch::Output); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
478
|
|
|
6
|
1
|
|
|
1
|
|
29440
|
use Test::More qw(); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
162
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
|
11
|
4
|
|
|
4
|
1
|
25187
|
my $proto = shift; |
|
12
|
4
|
|
33
|
|
|
22
|
my $class = ref($proto) || $proto; |
|
13
|
4
|
|
|
|
|
21
|
my $self = bless { }, $class; |
|
14
|
4
|
|
|
|
|
17
|
my %opts = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
4
|
|
|
|
|
30
|
$self->_basic_init(%opts); |
|
17
|
|
|
|
|
|
|
|
|
18
|
4
|
100
|
|
|
|
396
|
$self->{as_note} = 1 if ($opts{as_note}); |
|
19
|
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
17
|
return $self; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub log_message { |
|
24
|
4
|
|
|
4
|
1
|
319
|
my $self = shift; |
|
25
|
4
|
|
|
|
|
9
|
my %p = @_; |
|
26
|
|
|
|
|
|
|
$self->{as_note} |
|
27
|
|
|
|
|
|
|
? Test::More::note($p{message}) |
|
28
|
4
|
100
|
|
|
|
14
|
: Test::More::diag($p{message}); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Log::Dispatch::TestDiag - Log to Test::More's diagnostic output |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use Log::Dispatch; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $logger = Log::Dispatch->new( |
|
42
|
|
|
|
|
|
|
outputs => [ |
|
43
|
|
|
|
|
|
|
['TestDiag', min_level=>'debug', as_note=>0], |
|
44
|
|
|
|
|
|
|
], |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This module provides a C<Log::Dispatch> output that spits the logged records out |
|
50
|
|
|
|
|
|
|
using C<Test::More>'s diagnostic output. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 METHODS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=over |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item new() |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Constructs a new C<Log::Dispatch::TestDiag> object and returns it to the caller. |
|
59
|
|
|
|
|
|
|
Accepts standard C<Log::Dispatch::Output> parameters (e.g. C<min_level>). |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Also accepts an optional "C<as_note>" parameter, to indicate that output should |
|
62
|
|
|
|
|
|
|
be sent via C<Test::More::note()> instead of C<Test::More::diag()>. Difference |
|
63
|
|
|
|
|
|
|
is that a "note" only appears in the verbose TAP stream and does not get shown |
|
64
|
|
|
|
|
|
|
when running under a test harness. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item log_message(%p) |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Logs the given message. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Graham TerMarsch (cpan@howlingfrog.com) |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Copyright (C) 2011, Graham TerMarsch. All Rights Reserved. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This is free software, you can redistribute it and/or modify it under the |
|
81
|
|
|
|
|
|
|
Artistic-2.0 license. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=over |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item L<Log::Dispatch> |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |