File Coverage

lib/Beekeeper/Service/LogTail.pm
Criterion Covered Total %
statement 15 26 57.6
branch 0 2 0.0
condition n/a
subroutine 4 6 66.6
pod 2 2 100.0
total 21 36 58.3


line stmt bran cond sub pod time code
1             package Beekeeper::Service::LogTail;
2              
3 2     2   7245 use strict;
  2         6  
  2         98  
4 2     2   16 use warnings;
  2         15  
  2         123  
5              
6             our $VERSION = '0.09';
7              
8 2     2   26 use Beekeeper::Client;
  2         7  
  2         742  
9              
10             # Show errors from perspective of caller
11             $Carp::Internal{(__PACKAGE__)}++;
12              
13              
14             sub tail {
15 3     3 1 4007439 my ($class, %args) = @_;
16              
17 3         45 my $client = Beekeeper::Client->instance;
18 3         28 my $guard = $client->__use_authorization_token('BKPR_ADMIN');
19 3         15 my $timeout = delete $args{'timeout'};
20              
21 3         27 my $resp = $client->call_remote(
22             method => '_bkpr.logtail.tail',
23             params => \%args,
24             timeout => $timeout,
25             );
26              
27 3         17 return $resp->result;
28             }
29              
30             sub tail_async {
31 0     0 1   my ($class, %args) = @_;
32              
33 0           my $on_success = delete $args{'on_success'};
34 0           my $on_error = delete $args{'on_error'};
35              
36 0 0         unless ($on_error) {
37 0           my ($file, $line) = (caller)[1,2];
38 0     0     $on_error = sub { die $_[0]->message . " at $file line $line\n"; };
  0            
39             }
40              
41 0           my $client = Beekeeper::Client->instance;
42 0           my $guard = $client->__use_authorization_token('BKPR_ADMIN');
43 0           my $timeout = delete $args{'timeout'};
44              
45 0           $client->call_remote_async(
46             method => '_bkpr.logtail.tail',
47             params => \%args,
48             timeout => $timeout,
49             on_success => $on_success,
50             on_error => $on_error,
51             );
52             }
53              
54             1;
55              
56             __END__