lemonldap-ng/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Std.pm
Christophe Maudoux 028b0823e9 Typos
2022-02-10 22:44:35 +01:00

26 lines
537 B
Perl

package Lemonldap::NG::Common::Logger::Std;
use strict;
our $VERSION = '2.0.14';
sub new {
no warnings 'redefine';
my $level = $_[1]->{logLevel} || 'info';
my $show = 1;
foreach (qw(error warn notice info debug)) {
if ($show) {
eval
qq'sub $_ {print STDERR "[".localtime."] [LLNG:\$\$] [$_] \$_[1]\n"}';
}
else {
eval qq'sub $_ {1}';
}
$show = 0 if ( $level eq $_ );
}
die "Unknown logLevel $level" if ($show);
return bless {}, shift;
}
1;