Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Log-Any CPAN distribution.

Maintainer(s)' notes

DO NOT FILE TICKETS HERE

Instead, file tickets on Github here → Log Any Issues.

Report information
The Basics
Id: 86794
Status: resolved
Priority: 0/
Queue: Log-Any

People
Owner: Nobody in particular
Requestors: xenoterracide [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: filter support
Date: Tue, 9 Jul 2013 00:21:44 -0500
To: bugs-log-any [...] rt.cpan.org
From: Caleb Cushing <xenoterracide [...] gmail.com>
It'd be nice if Log::Any could allow for some kind of filter/callback support where I could do something like # pseodo perl Log::Any->set_filter(sub { my ( $msg, $obj) = @_; return sprintf('%s %s %s', date, $msg, json( $obj ) ); }); this way you wouldn't have to put this kind of logic where Log::Any is called. It would be called before passing it to the final logger. Bonus points if it could get attached to either a specific log engine/category, etc. -- Caleb Cushing http://xenoterracide.com Calendar: https://www.google.com/calendar/embed?src=xenoterracide%40gmail.com&ctz=America/Chicago
On Tue Jul 09 01:21:58 2013, XENO wrote: Show quoted text
> Log::Any->set_filter(sub { > my ( $msg, $obj) = @_; > return sprintf('%s %s %s', date, $msg, json( $obj ) ); > });
I think this is tricky because Log::Any really only defines the API for Adapters and they are responsible for all the actual processing. The log object isa Log::Any::Adapter::Base. It seems like there would need to be a facade put around the Adapter. I'll ponder it.
Log::Any::Proxy in the new Log-Any-1.XX on CPAN has support for this.