From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more
— |
sub load {
my ( $class , $config ) = @_ ;
my $module = $config ->{ 'driver' } || "Prancer::Logger::Console" ;
try {
Module::Load::load( $module );
} catch {
my $error = ( defined ( $_ ) ? $_ : "unknown" );
die "could not initialize logger: not able to load ${module}: ${error}\n" ;
};
for ( qw(debug info warn error fatal) ) {
die "could not initialize logger: ${module} doesn't implement '${_}'\n" unless $module ->can( $_ );
}
return $module ->new( $config ->{ 'options' });
}
1;
|