diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-07-26 16:42:54 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-07-26 16:42:54 -0500 |
commit | 14a5274c8b8cd2700d7141c8c15903bac881d46c (patch) | |
tree | a84ae1250010d5947153172327528768dde6f705 /httemplate | |
parent | a1930173f49200333e347b87c01c3edabc1ebb9c (diff) |
RT#38217: Send email when logging conditions are met [removed unwanted log levels, preserved level num mapping]
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/log_email.html | 2 | ||||
-rw-r--r-- | httemplate/edit/log_email.html | 4 | ||||
-rw-r--r-- | httemplate/search/log.html | 31 |
3 files changed, 17 insertions, 20 deletions
diff --git a/httemplate/browse/log_email.html b/httemplate/browse/log_email.html index 0f64dd454..007ea6f74 100644 --- a/httemplate/browse/log_email.html +++ b/httemplate/browse/log_email.html @@ -21,7 +21,7 @@ ], 'fields' => [ 'logemailnum', sub { $_[0]->context || '(all)' }, - sub { $FS::Log::LEVELS[$_[0]->min_level] }, + sub { $FS::Log::LEVELS{$_[0]->min_level} }, 'msgname', 'to_addr', $actions, diff --git a/httemplate/edit/log_email.html b/httemplate/edit/log_email.html index 0c98046d3..b79aba986 100644 --- a/httemplate/edit/log_email.html +++ b/httemplate/edit/log_email.html @@ -16,8 +16,8 @@ }, { 'field' => 'min_level', 'type' => 'select', - 'options' => [ 0..7 ], - 'labels' => { map {$_ => $FS::Log::LEVELS[$_]} 0..7 }, + 'options' => [ &FS::Log::levelnums ], + 'labels' => { &FS::Log::levelmap }, 'curr_value' => scalar($cgi->param('min_level')), }, 'to_addr', diff --git a/httemplate/search/log.html b/httemplate/search/log.html index 111200f55..5b330f899 100644 --- a/httemplate/search/log.html +++ b/httemplate/search/log.html @@ -81,15 +81,15 @@ a:visited {text-decoration: none} <TD>Level <& /elements/select.html, field => 'min_level', - options => [ 0..7 ], - labels => { map {$_ => $FS::Log::LEVELS[$_]} 0..7 }, + options => [ &FS::Log::levelnums ], + labels => { &FS::Log::levelmap }, curr_value => $cgi->param('min_level'), &> to <& /elements/select.html, field => 'max_level', - options => [ 0..7 ], - labels => { map {$_ => $FS::Log::LEVELS[$_]} 0..7 }, + options => [ &FS::Log::levelnums ], + labels => { &FS::Log::levelmap }, curr_value => $cgi->param('max_level'), &> </TD> @@ -128,7 +128,7 @@ a:visited {text-decoration: none} <%once> my $date_sub = sub { time2str('%Y-%m-%d %T', $_[0]->_date) }; -my $level_sub = sub { $FS::Log::LEVELS[$_[0]->level] }; +my $level_sub = sub { $FS::Log::LEVELS{$_[0]->level} }; my $context_sub = sub { my $log = shift; @@ -191,18 +191,15 @@ my $object_link_sub = sub { } }; -my @colors = ( - '404040', #debug - '0000aa', #info - '00aa00', #notice - 'aa0066', #warning - '000000', #error - 'aa0000', #critical - 'ff0000', #alert - 'ff0000', #emergency +my %colors = ( + 0 => '404040', #debug, gray + 1 => '000000', #info, black + 3 => '0000aa', #warning, blue + 4 => 'aa0066', #error, purple + 5 => 'ff0000', #critical, red ); -my $color_sub = sub { $colors[ $_[0]->level ]; }; +my $color_sub = sub { $colors{ $_[0]->level }; }; my @contexts = ('', sort FS::log_context->contexts); </%once> @@ -212,10 +209,10 @@ die "access denied" unless $curuser->access_right([ 'View system logs', 'Configuration' ]); my @menubar = (); -push @menubar, qq(<A HREF="${fsurl}browse/log_email.html" STYLE="text-decoration: underline;">Configure conditions for sending email when logging</A>), +push @menubar, qq(<A HREF="${fsurl}browse/log_email.html" STYLE="text-decoration: underline;">Configure conditions for sending email when logging</A>); $cgi->param('min_level', 0) unless defined($cgi->param('min_level')); -$cgi->param('max_level', 7) unless defined($cgi->param('max_level')); +$cgi->param('max_level', 5) unless defined($cgi->param('max_level')); my %search = (); $search{'date'} = [ FS::UI::Web::parse_beginning_ending($cgi) ]; |