[Dancer-users] Dancer2 - feature change request

Richard Huxton dev at archonet.com
Fri Oct 21 11:55:46 CEST 2011

Since dancer2 is on the way, I thought I'd be cheeky and suggest a 
slight change in functionality (rather than wait until dancer3). Does 
anyone (particularly core devs of course) have any strong opinions on 
the following?

At the moment, the logging levels are exposed directly (debug, warning, 
error). All the major logging modules seem to expose a single object 
(Log::Log4perl, Log::Dispatch, Log::Any etc). Doing similar would make 
logging more consistent across dancer and my non-web modules.

To be explicit, I'm suggesting this:
   debug("current id = $id")
would become:
   log->debug("current id = $id")

It's a purely cosmetic change at one level, but it does:
1. Reduce namespace pollution
2. Allow for alternative log-levels

I actually think the printf-style functionality of Log::Any is worth 
stealing too. It lets you do things like:
   log->debugf("user %d has fields %s", $user_id, $user_hashref)
With $user_hashref being automatically piped through Data::Dumper

   Richard Huxton
   Archonet Ltd

More information about the Dancer-users mailing list