# override the stringification of @_ with something more sensible.
BEGIN {
- @LEVELS = qw(debug info warning error critical);
+ @LEVELS = qw(debug info notice warning error critical alert emergency);
foreach my $l (@LEVELS) {
my $sub = sub {
tie my %hash, 'Tie::IxHash',
- #remap log levels
- 'log' => [],
-
#cust_main (remove paycvv from history, locations, cust_payby, etc)
'cust_main' => [],
use FS::UID qw( dbh driver_name );
use FS::log_context;
use FS::log_email;
-use FS::upgrade_journal;
=head1 NAME
};
}
-sub _upgrade_data {
- my ($class, %opts) = @_;
-
- return if FS::upgrade_journal->is_done('log__remap_levels');
-
- tie my %levelmap, 'Tie::IxHash',
-# 0 => 0, #debug
-# 1 => 1, #info
- 2 => 1, #notice -> info
- 3 => 2, #warning
- 4 => 3, #error
- 5 => 4, #critical
- 6 => 4, #alert -> critical
- 7 => 4, #emergency -> critical
- ;
-
- # this method should never autocommit
- # should have been set in upgrade, but just in case...
- local $FS::UID::AutoCommit = 0;
-
- # FS::log has no replace method
- # in practice, only debug/info/warning/error were used,
- # so this should only hit warning/error
- foreach my $old (keys %levelmap) {
- my $sql = 'UPDATE log SET level=' . dbh->quote($levelmap{$old}) . ' WHERE level=' . dbh->quote($old);
- warn $sql unless $opts{'quiet'};
- my $sth = dbh->prepare($sql) or die dbh->errstr;
- $sth->execute() or die $sth->errstr;
- $sth->finish();
- }
-
- foreach my $log_email (
- qsearch('log_email',{ 'min_level' => { 'op' => '>=', 'value' => '2' } })
- ) {
- $log_email->min_level($levelmap{$log_email->min_level});
- my $error = $log_email->replace;
- if ($error) {
- dbh->rollback;
- die $error;
- }
- }
-
- FS::upgrade_journal->set_done('log__remap_levels');
-
-}
-
=back
=head1 BUGS
},
{ 'field' => 'min_level',
'type' => 'select',
- 'options' => [ 0..4 ],
- 'labels' => { map {$_ => $FS::Log::LEVELS[$_]} 0..4 },
+ 'options' => [ 0..7 ],
+ 'labels' => { map {$_ => $FS::Log::LEVELS[$_]} 0..7 },
'curr_value' => scalar($cgi->param('min_level')),
},
'to_addr',
<TD>Level
<& /elements/select.html,
field => 'min_level',
- options => [ 0..4 ],
- labels => { map {$_ => $FS::Log::LEVELS[$_]} 0..4 },
+ options => [ 0..7 ],
+ labels => { map {$_ => $FS::Log::LEVELS[$_]} 0..7 },
curr_value => $cgi->param('min_level'),
&>
to
<& /elements/select.html,
field => 'max_level',
- options => [ 0..4 ],
- labels => { map {$_ => $FS::Log::LEVELS[$_]} 0..4 },
+ options => [ 0..7 ],
+ labels => { map {$_ => $FS::Log::LEVELS[$_]} 0..7 },
curr_value => $cgi->param('max_level'),
&>
</TD>
};
my @colors = (
- '404040', #debug, gray
- '000000', #info, black
- '0000aa', #warning, blue
- 'aa0066', #error, purple
- 'ff0000', #critical, red
+ '404040', #debug
+ '0000aa', #info
+ '00aa00', #notice
+ 'aa0066', #warning
+ '000000', #error
+ 'aa0000', #critical
+ 'ff0000', #alert
+ 'ff0000', #emergency
);
my $color_sub = sub { $colors[ $_[0]->level ]; };