Logging All Calls

51 views
Skip to first unread message

Don Walter

unread,
Jun 19, 2015, 3:19:21 PM6/19/15
to taffy...@googlegroups.com
My place of employment currently logs all calls, request and response, to a database. We're trying to create REST services to go along with our current SOAP services, and have so far been very impressed with Taffy, but one thing we haven't been able to find an elegant solution to is logging the calls... specifically the responses

Currently, the way I'm doing it that I pass in the mimExt to the resource functions in the onTaffyRequest function. Then at the end of each resource function, I check the arguments.mimeExt to see if the user requested XML or JSON, and then log either representationOf(local.qryResults).getAsXML() or representationOf(local.qryResults).getAsJSON()

This works, but we were hoping to find some solution that didn't involve us putting this logging code inside each function, and also not having to convert the results to XML/JSON twice for every function to be able to log it

Is there any better way to accomplish this that I'm just not seeing?

Thanks in advance

Adam Tuttle

unread,
Jun 19, 2015, 7:52:10 PM6/19/15
to taffy...@googlegroups.com
I don't think there's a better way currently - no! But that doesn't mean I won't entertain a pull request that adds one! ;)

My suggestion would be an onTaffyRequestEnd() method that takes all of the same arguments as onTaffyRequest(), but also receives the response body (maybe both as text and as native data?)...

Adam

--
You received this message because you are subscribed to the Google Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to taffy-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Don Walter

unread,
Jun 22, 2015, 9:16:33 AM6/22/15
to taffy...@googlegroups.com
I'm on it, Adam! Will see what I can come up with

Jon Alsbury

unread,
Jun 23, 2015, 8:19:45 AM6/23/15
to taffy...@googlegroups.com
If you are using an IOC framework that supports AOP (such as ColdSpring) to manage your resources and their dependencies, a simple advice chain would be an elegant way of handling this.

Regards, JA.

--

Don Walter

unread,
Jul 6, 2015, 4:12:26 PM7/6/15
to taffy...@googlegroups.com
A pull request has been submitted with this functionality. It's my first pull request on GitHub, so apologies if I did it incorrectly




On Friday, June 19, 2015 at 7:52:10 PM UTC-4, Adam Tuttle wrote:

Adam Tuttle

unread,
Jul 6, 2015, 4:39:53 PM7/6/15
to taffy...@googlegroups.com

Don Walter

unread,
Jul 7, 2015, 1:01:40 AM7/7/15
to taffy...@googlegroups.com
Ah, looks like I screwed it up. You should see it now

Thanks

Don

Adam Tuttle

unread,
Jul 7, 2015, 9:00:09 AM7/7/15
to taffy...@googlegroups.com
I see it, thanks! Hopefully I'll get some time to look at it soon. Thanks for the contrib!
Reply all
Reply to author
Forward
0 new messages