[Dancer-users] Dancer logging stringifies some data
sawyer x
xsawyerx at gmail.com
Fri Jun 22 21:50:39 CEST 2012
I've been trying to write a test case for this, but have so far failed.
I can see that if I print the data, it will change it from NV to PV, but I
can't get the abstract class's format_message() method to flip it, nor can
I get the Console logger (whether catching the print using Capture::Tiny or
simply printing it to screen) to do it either.
Could you provide more info? Perhaps a bit more code?
So far the following has failed to change it from NV to PV:
- calling format_message() directly.
- creating a Console logger and printing it inside Capture::Tiny.
- creating a Console logger and printing it to screen without capturing.
The only way I got it to flip was to simply do "print" manually.
On Thu, Jun 21, 2012 at 7:00 PM, Ovid <curtis_ovid_poe at yahoo.com> wrote:
> Hi all,
>
> I don't have the time to fix this right now, but we had a very interesting
> issue. I had this line in my code:
>
> info "Bidding on auction $id", $bid;
>
> That turned out to be a massive bug!
>
> $bid is a hashref that gets serialized to JSON. Unfortunately, the act of
> printing out the data flipped one value from an NV (float) to a PV
> (string). That caused the JSON serializer render 1.2 as "1.2". Sadly, the
> system I was sending this data to reported a bizarre "Request throttled"
> error instead of a JSON validation error.
>
> The simple fix was to drop the $bid from the info() and add a test to
> ensure that I have a NV instead of a PV.
>
> If anyone wants to look into this, that would be great. Perhaps adding
> optional cloning of the data in the logger prior to printing it out?
> (Optional because it might be expensive)
>
> Cheers,
> Ovid
> --
> Live and work overseas - http://www.overseas-exile.com/
> Buy the book - http://www.oreilly.com/catalog/perlhks/
> Tech blog - http://blogs.perl.org/users/ovid/
> Twitter - http://twitter.com/OvidPerl/
>
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20120622/914eee72/attachment.htm>
More information about the Dancer-users
mailing list