Distinct log/userLog in Dispatch (#1419)

This commit is contained in:
Xavier Guimard 2018-05-11 17:24:56 +02:00
parent 3984fba973
commit 77a558e13a
1 changed files with 5 additions and 4 deletions

View File

@ -7,16 +7,17 @@ our $VERSION = '2.0.0';
sub new {
no warnings 'redefine';
my $self = bless {}, shift;
my ($conf) = @_;
my ($conf,%args) = @_;
my %bck;
my $last;
my $show = 1;
unless ( $conf->{logDispatchError} ) {
die 'At least, logDispatchError must be defined in conf';
my $root = $args{user} ? 'userLogDispatch' : 'logDispatch';
unless ( $conf->{$root.'Error'} ) {
die "At least, ${root}Error must be defined in conf";
}
foreach my $l (qw(error warn notice info debug)) {
if ($show) {
$last = $conf->{ "logDispatch" . ucfirst($l) } || $last;
$last = $conf->{ $root . ucfirst($l) } || $last;
unless ( $bck{$last} ) {
eval "require $last";
die $@ if ($@);