Diag.pm revision 1.1.1.5
1package Test2::Event::Diag;
2use strict;
3use warnings;
4
5our $VERSION = '1.302194';
6
7
8BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
9use Test2::Util::HashBase qw/message/;
10
11sub init {
12    $_[0]->{+MESSAGE} = 'undef' unless defined $_[0]->{+MESSAGE};
13}
14
15sub summary { $_[0]->{+MESSAGE} }
16
17sub diagnostics { 1 }
18
19sub facet_data {
20    my $self = shift;
21
22    my $out = $self->common_facet_data;
23
24    $out->{info} = [
25        {
26            tag     => 'DIAG',
27            debug   => 1,
28            details => $self->{+MESSAGE},
29        }
30    ];
31
32    return $out;
33}
34
351;
36
37__END__
38
39=pod
40
41=encoding UTF-8
42
43=head1 NAME
44
45Test2::Event::Diag - Diag event type
46
47=head1 DESCRIPTION
48
49Diagnostics messages, typically rendered to STDERR.
50
51=head1 SYNOPSIS
52
53    use Test2::API qw/context/;
54    use Test2::Event::Diag;
55
56    my $ctx = context();
57    my $event = $ctx->diag($message);
58
59=head1 ACCESSORS
60
61=over 4
62
63=item $diag->message
64
65The message for the diag.
66
67=back
68
69=head1 SOURCE
70
71The source code repository for Test2 can be found at
72F<http://github.com/Test-More/test-more/>.
73
74=head1 MAINTAINERS
75
76=over 4
77
78=item Chad Granum E<lt>exodist@cpan.orgE<gt>
79
80=back
81
82=head1 AUTHORS
83
84=over 4
85
86=item Chad Granum E<lt>exodist@cpan.orgE<gt>
87
88=back
89
90=head1 COPYRIGHT
91
92Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>.
93
94This program is free software; you can redistribute it and/or
95modify it under the same terms as Perl itself.
96
97See F<http://dev.perl.org/licenses/>
98
99=cut
100