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   6759 use strict;
  2         14  
  2         100  
4 2     2   19 use warnings;
  2         9  
  2         152  
5              
6             our $VERSION = '0.08';
7              
8 2     2   24 use Beekeeper::Client;
  2         10  
  2         782  
9              
10             # Show errors from perspective of caller
11             $Carp::Internal{(__PACKAGE__)}++;
12              
13              
14             sub tail {
15 3     3 1 4004349 my ($class, %args) = @_;
16              
17 3         36 my $client = Beekeeper::Client->instance;
18 3         26 my $guard = $client->__use_authorization_token('BKPR_ADMIN');
19 3         10 my $timeout = delete $args{'timeout'};
20              
21 3         47 my $resp = $client->call_remote(
22             method => '_bkpr.logtail.tail',
23             params => \%args,
24             timeout => $timeout,
25             );
26              
27 3         31 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__