Structured/Event/ScriptRun.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
« Structured.pm ↑ Summary Structured/Stringify/AsJSON.pm »
1 package Log::Message::Structured::Event::ScriptRun;
2 0 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=2.6
3 use MooseX::Types::Moose qw/ Str Int /;
4 use namespace::clean -except => 'meta';
5  
6 has script_name => (
7 is => 'ro',
8 isa => Str,
9 default => sub { $0 },
10 );
11  
12 my $starttime = time();
13 has time => (
14 is => 'ro',
15 isa => Int,
16 default => sub { time() - $starttime },
17 );
18  
19 # FIXME - User running script?
20  
21 with qw( Log::Message::Structured
22 Log::Message::Structured::Component::Date
23 Log::Message::Structured::Component::Hostname
24 );
25 with 'Log::Message::Structured::Stringify::Sprintf' => {
26 format_string => q{Script %s run on %s for %ss},
27 attributes => [qw/ script_name hostname time /],
28 };
29  
30 =head1 NAME
31  
32 Log::Message::Structured::Event::ScriptRun
33  
34 =head1 DESCRIPTION
35  
36 Some Event.
37  
38 =cut
39  
40 __PACKAGE__->meta->make_immutable;
41 1;
42  
« Structured.pm ↑ Summary Structured/Stringify/AsJSON.pm »