| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package XAS::Logmon::Output::Spool; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use XAS::Factory; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
10
|
|
|
6
|
1
|
|
|
1
|
|
489
|
use Try::Tiny::Retry ':all'; |
|
|
1
|
|
|
|
|
1208
|
|
|
|
1
|
|
|
|
|
140
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use XAS::Class |
|
9
|
1
|
|
|
|
|
5
|
debug => 0, |
|
10
|
|
|
|
|
|
|
version => $VERSION, |
|
11
|
|
|
|
|
|
|
base => 'XAS::Base', |
|
12
|
|
|
|
|
|
|
mixin => 'XAS::Lib::Mixins::Handlers', |
|
13
|
|
|
|
|
|
|
utils => ':validation', |
|
14
|
|
|
|
|
|
|
constants => 'TRUE FALSE', |
|
15
|
|
|
|
|
|
|
accessors => 'spool', |
|
16
|
|
|
|
|
|
|
filesystem => 'Dir', |
|
17
|
1
|
|
|
1
|
|
5
|
; |
|
|
1
|
|
|
|
|
1
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
20
|
|
|
|
|
|
|
# Public Methods |
|
21
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub put { |
|
24
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
25
|
0
|
|
|
|
|
|
my ($data) = validate_params(\@_, [1]); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
retry { |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
|
|
$self->spool->write($data); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} delay_exp { |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
|
|
30, 1000 # attempts, delay in milliseconds |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} retry_if { |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
0
|
|
|
my $ex = $_; |
|
38
|
0
|
|
|
|
|
|
my $ref = ref($ex); |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
0
|
0
|
|
|
|
if ($ref && $ex->isa('XAS::Exception')) { |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
return TRUE if ($ex->match_type('xas.lib.modules.spool')); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return FALSE; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} catch { |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
|
|
my $ex = $_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
$self->exception_handler($ex); |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
59
|
|
|
|
|
|
|
# Private Methods |
|
60
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub init { |
|
63
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $self = $class->SUPER::init(@_); |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$self->{'spool'} = XAS::Factory->module('spool', { |
|
68
|
|
|
|
|
|
|
-directory => Dir($self->env->spool, 'logs'), |
|
69
|
|
|
|
|
|
|
-lock => Dir($self->env->spool, 'logs', 'locked')->path |
|
70
|
|
|
|
|
|
|
}); |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return $self; |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |