Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Dancer Log object?

Normally when using dancer you call, for example

debug 'foo';

and it will log the text. But I want to be able to log stuff in an object that doesn't import the dancer syntax. I'm wondering if there's a way to get dancer to just hand me it's log object (I assume there is one) so that I can call things like debug using an object syntax, e.g.

$logger->debug( 'foo' );
like image 347
xenoterracide Avatar asked Mar 22 '12 20:03

xenoterracide


1 Answers

use Dancer::Logger::Console;

my $logger = Dancer::Logger::Console->new;
$logger->debug("Perl Dancer Rocks!");

You can replace the Console logger with any other logger you want such as Syslog or ConsoleAggregator

like image 138
KnightHacker Avatar answered Oct 14 '22 23:10

KnightHacker