I'd be a little concerned about wholesale wrapping of functions, purely from
the perspective that you'll be wrapping mostly side-effect free functions
with functions that do have side-effects. That sounds like something you'd
want to do consciously, where you know it will be safe, and where the
results will be meaningful ( I imagine that logging inside retry blocks
could reduce your logs to meaningless pudding pretty quickly ).
On the other hand, I could just be being paranoid.


R.


2009/10/20 Jeff Sapp <jas...@gmail.com>

>
> Hey, I'm working on a small to medium sized, hopefully commercial
> product in clojure. I'll be providing an API to clients, and I'm also
> going to have to make some performance guarantees about a few of my
> functions. Because of that (as well as a few other reasons), I'm very
> interested interested in being able to log every little detail related
> to client interaction including call times for some critical
> functions.
>
> In the past I would have defined a macro similar to
> clojure.contrib.trace/deftrace, let's say named defn-logging, that
> wrapped it's definition in the appropriate logging functions. Then I
> would have defined all my functions with defn-logging instead of defn.
> This is completely unfounded, but that doesn't strike me as being very
> clean. Am I justified in thinking this?
>
> I had one, probably very bad, idea of creating a separate namespace
> for the logging functions that simply pointed to their non-logging
> counterparts in the original namespace. I'm not sure if that's even
> possible without wrapping defn in a macro. Certainly, I think it'd be
> difficult to do cleanly.
>
> During Rich's "Clojure for Lispers" talks, he mentioned rebinding
> functions, and being able to use it for the purpose of logging. I
> think in my case, I'd need to do this globally some how to avoid using
> a macro like defn-logging. It's escaped me, how would I go about doing
> this? Is redefining global values like this a good idea?
>
> Any suggestions?
>
> Thanks,
> ~jeff
>
> >
>


-- 
Blog : http://robertlally.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to