OpenTracing/Log.pm

filter: Statementstmt 72.0% 18 / 25 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 55.5% 5 / 9 Podpod 100% 4 / 4 totaltotal 65.8% 27 / 41 CC 2 SCAR 8.3
CC
2
Cov
67%
tag_list
6.0
timestamp
2.0
tags
2.0
CRAP 2.3
« OpenTracing/Process.pm ↑ Summary OpenTracing/DSL.pm »
1 package OpenTracing::Log;
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 our $VERSION = '1.006'; # VERSION
7 8 our $AUTHORITY = 'cpan:TEAM'; # AUTHORITY
8  
9 8 ▶use parent qw(OpenTracing::Common);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 8 ▶no indirect;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 8 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =encoding utf8
15  
16 =head1 NAME
17  
18 OpenTracing::Log - represents a single log message
19  
20 =head1 DESCRIPTION
21  
22 Each instance represents one log message.
23  
24 =cut
25  
26 =head1 METHODS
27  
28 =head2 timestamp
29  
30 When this message was logged.
31  
32 =cut
33  
34 0 ▶sub timestamp { shift->{timestamp} }
Subroutine timestamp: not called CC=1 SCAR=6.9
Pod documented
35  
36 =head2 tags
37  
38 Arrayref of tags relating to the log entry.
39  
40 =cut
41  
42 0 ▶sub tags { shift->{tags} }
Subroutine tags: not called CC=1 SCAR=6.9
Pod documented
43  
44 =head2 tag_list
45  
46 List of tags relating to the log entry.
47  
48 =cut
49  
50 0 ▶sub tag_list { (shift->{tags} //= [])->@* }
Subroutine tag_list: not called CC=2 SCAR=17.9
Pod documented
Condition0%0/2
+(shift())->{"tags"} //= []
l!l
00
MC/DC0%0/1
+(shift())->{"tags"} //= []
+(shift())->{"tags"}
Truth table0%0/2
A
A= +(shift())->{"tags"}
Aresult
11
00
51  
52 =head2 tag
53  
54 Applies key/value tags to this log message.
55  
56 The L<semantic conventions|https://github.com/opentracing/specification/blob/master/semantic_conventions.md>
57 may be of interest here.
58  
59 Example usage:
60  
61 $log->tag(
62 'error.kind' => 'Exception',
63 'error.object' => $exception,
64 );
65  
66 =cut
67  
68 0 ▶sub tag : method {
Subroutine tag: not called CC=1 SCAR=6.9
Pod documented
69 0 my ($self, %args) = @_;
70 0 @{$self->{tags}}{keys %args} = values %args;
71 0 return $self;
72 }
73  
74 8 1;
75  
76 __END__
« OpenTracing/Process.pm ↑ Summary OpenTracing/DSL.pm »