File Coverage

blib/lib/OpenTracing/Log.pm
Criterion Covered Total %
statement 15 22 68.1
branch n/a
condition 0 2 0.0
subroutine 5 9 55.5
pod 4 4 100.0
total 24 37 64.8


line stmt bran cond sub pod time code
1             package OpenTracing::Log;
2              
3 2     2   14 use strict;
  2         3  
  2         61  
4 2     2   8 use warnings;
  2         4  
  2         94  
5              
6             our $VERSION = '1.006'; # VERSION
7             our $AUTHORITY = 'cpan:TEAM'; # AUTHORITY
8              
9 2     2   10 use parent qw(OpenTracing::Common);
  2         4  
  2         8  
10              
11 2     2   118 no indirect;
  2         4  
  2         11  
12 2     2   84 use utf8;
  2         7  
  2         27  
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     0 1   sub timestamp { shift->{timestamp} }
35              
36             =head2 tags
37              
38             Arrayref of tags relating to the log entry.
39              
40             =cut
41              
42 0     0 1   sub tags { shift->{tags} }
43              
44             =head2 tag_list
45              
46             List of tags relating to the log entry.
47              
48             =cut
49              
50 0   0 0 1   sub tag_list { (shift->{tags} //= [])->@* }
51              
52             =head2 tag
53              
54             Applies key/value tags to this log message.
55              
56             The L
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             sub tag : method {
69 0     0 1   my ($self, %args) = @_;
70 0           @{$self->{tags}}{keys %args} = values %args;
  0            
71 0           return $self;
72             }
73              
74             1;
75              
76             __END__