line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# vim: set ts=2 sw=2 tw=0: |
5
|
|
|
|
|
|
|
# vim: set expandtab: |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rex::JobControl::Helper::AuditLog; |
8
|
|
|
|
|
|
|
$Rex::JobControl::Helper::AuditLog::VERSION = '0.7.0'; |
9
|
1
|
|
|
1
|
|
4
|
use base 'Mojo::Log'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
69
|
|
10
|
1
|
|
|
1
|
|
5
|
use Mojo::JSON; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
11
|
1
|
|
|
1
|
|
1373
|
use DateTime; |
|
1
|
|
|
|
|
174372
|
|
|
1
|
|
|
|
|
279
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
1
|
|
|
1
|
1
|
21
|
my $that = shift; |
15
|
1
|
|
33
|
|
|
61
|
my $proto = ref($that) || $that; |
16
|
1
|
|
|
|
|
15
|
my $self = $proto->SUPER::new(@_); |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
64
|
bless( $self, $proto ); |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
15
|
$self->{json} = Mojo::JSON->new; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
11
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub audit { |
26
|
0
|
|
|
0
|
0
|
|
my ( $self, $data ) = @_; |
27
|
0
|
|
|
|
|
|
my ( $package, $filename, $line ) = caller; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $dt = DateTime->now; |
30
|
0
|
|
|
|
|
|
$data->{package} = $package; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$self->info( $self->json->encode($data) ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
0
|
|
sub json { (shift)->{json} } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |