[Dancer-users] Dancer2 - feature change request

damien krotkine dkrotkine at gmail.com
Fri Oct 21 21:19:24 CEST 2011

Le 21 oct. 2011 à 20:23, Naveed Massjouni <naveedm9 at gmail.com> a
écrit :

> On Fri, Oct 21, 2011 at 5:55 AM, Richard Huxton <dev at archonet.com>
> wrote:
>> 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
> I really like your suggestion. Mainly because I wish send_error() was
> error(). Writing return error(...); is much more natural than return
> send_error(...); Though it is probably too late to change that now. I
> know ambs/dams? has a branch for making send_error do call stack magic
> to solve that.

Indeed it's a PR ready for merging. It just need some review from
other core devs ( hint ! hint ! ). Come on guys, just reply
"approved" :)

More information about the Dancer-users mailing list