Engine/Alerting/Log.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 2 Conditioncond n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 62 CC 2 SCAR 10.3
CC
2
Cov
0%
new
6.0
to_console
2.0
to_file
2.0
CRAP 2.8
1 package Service::Engine::Alerting::Log;
2  
3 use 5.010;
4 use strict;
5 use warnings;
6 use Data::Dumper;
7 use Service::Engine;
8  
9 our $Config;
10 our $Log;
11 our $Alert;
12  
13 sub new {
14
15 my ($class,$options) = @_;
16
17 # set some defaults
18 my $attributes = {'method'=>''};
19
20 # load options
21 if (ref($options) eq 'HASH') {
22 foreach my $option (keys %{$options}) {
23 $attributes->{$option} = $options->{$option};
24 }
25 }
26
27 # pull in some Service::Engine globals
28 $Config = $Service::Engine::Config;
29 $Log = $Service::Engine::Log;
30
31 my $self = bless $attributes, $class;
32
33 return $self;
34  
35 }
36  
37  
38 sub to_console {
39  
40 my ($self, $args) = @_;
41
42 my $msg = $args->{'msg'};
43
44 my $log = {'msg'=>"ALERT: " . $msg,'level'=>2};
45
46 $Log->to_console($log);
47
48 return 1;
49
50 }
51  
52 sub to_file {
53  
54 my ($self, $args) = @_;
55
56 my $msg = $args->{'msg'};
57
58 my $log = {'msg'=>"ALERT: " . $msg,'level'=>2};
59
60 $Log->to_file($log);
61
62 return 1;
63
64 }
65  
66 sub to_data {
67  
68 my ($self, $args) = @_;
69
70 my $msg = $args->{'msg'};
71
72 my $log = {'msg'=>"ALERT: " . $msg,'level'=>2};
73
74 $Log->to_data($log);
75
76 return 1;
77
78 }
79  
80  
81 1;