package Dancer::Logger; # Factory for logger engines use strict;
use warnings; use Data::Dumper; use Dancer::Engine; # singleton
used for logging messages my $logger; sub logger {$logger} sub
init { my ($class, $name, $config) = @_; $logger =
Dancer::Engine->build(logger => $name, $config); } sub
_serialize { my @vars = @_; return join q{}, map { ref $_ ?
Data::Dumper->new([$_]) ->Terse(1) ->Purity(1) ->Indent(0)
->Sortkeys(1) ->Dump() : (defined($_) ? $_ : 'undef') } @vars; }
sub core { defined($logger) and $logger->core( _serialize(@_) )
} sub debug { defined($logger) and $logger->debug(
_serialize(@_) ) } sub info { defined($logger) and
$logger->info( _serialize(@_) ) } sub warning { defined($logger)
and $logger->warning( _serialize(@_) ) } sub error {
defined($logger) and $logger->error( _serialize(@_) ) } 1;
__END__ =pod =head1 NAME Dancer::Logger - common interface for
logging in Dancer =head1 DESCRIPTION This module is the wrapper
that provides support for different logger engines. =head1 USAGE
=head2