[Dancer-users] Dancer2 - feature change request
Flavio Poletti
polettix at gmail.com
Fri Oct 21 19:09:46 CEST 2011
On Fri, Oct 21, 2011 at 11:55 AM, Richard Huxton <dev at archonet.com> wrote:
> 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
>
Namespace pollution is - for good or bad - what Dancer is about; otherwise,
there would be no DSL. I like the idea of having one-off functions for
logging as for anything else, even if I like Log::Log4perl and I usually
avoid Dancer's internal debugging. IMHO your proposal should go on the
Plugin side (e.g. Dancer::Plugin::Log::Log4perl)
> 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
I like the idea of the "-f", but this would probably bloat and pollute the
namespace. Again... this would be a nice plugin :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20111021/23fef941/attachment.htm>
More information about the Dancer-users
mailing list