Ok, I've updated the code with some of Tim's code:
http://paste.lisp.org/display/84053

The "public" functions/macros are:

enabled? [level] [level log-name]
  true/false whether that level is enabled for the current namespace
or log-name

log [level message ...]
  logs the message either directly or via an agent.  The selection
logic defaults to agent, unless the *allow-direct-logging* flag is set
to true and the log is not being called from within a running
transaction.

debug [expr]
  Evaluates and returns the expr.  If debug is enabled logs the form
and its result.

log-capture! [log-name]
  Redirects writes of System.out and System.err to the logs

log-uncapture!
  Restores the System.out and System.err to their defaults.

with-logs [log-name & body]
  Evaluates the body with *out* and *err* redirected to the logs




On Jul 22, 11:53 am, ataggart <alex.tagg...@gmail.com> wrote:
> Tim, you're too modest.  I'm incorporating some of your stuff now.
> I'll update once it's done.
>
> On Jul 22, 12:04 am, Timothy Pratley <timothyprat...@gmail.com> wrote:
>
>
>
> > Hi Alex,
>
> > You've got my vote - logging is essential for non-trivial programs.
>
> > Your implementation is superior to mine, but maybe you would like to
> > include some 
> > sub-parts:http://github.com/timothypratley/strive/blob/baf83e2bb26662f5f5049d16...
>
> > log-capture    -> grabs normal prints if any are left in the code
> > log-format     -> better output for java.logging
> > logged-future   -> I find handy for long running threads
> > debug          -> its nice to be able to log an expression and what
> > its evaluated to while leaving it in place (+ (debug (+ 1 2)) 3)
> > current-function-name (Stephen C. Gilardi posted)  -> optionally
> > including the function and thread id
>
> > Regards,
> > Tim.
>
> > On Jul 22, 3:13 pm, ataggart <alex.tagg...@gmail.com> wrote:
>
> > > I've written up a small set of logging functions to output from
> > > clojure what I'm already doing from my production java code.
>
> > > Currently it checks for the presence of commons-logging, log4j, and
> > > finally java.util.logging.  The clojure code doesn't actually do any
> > > logging itself; instead everything is delegated to whatever you've
> > > been using all along.
>
> > > I've stuck the code athttp://paste.lisp.org/display/83982
>
> > > I'd welcome any thoughts, particularly if this merits going into
> > > clojure-contrib.
--~--~---------~--~----~------------~-------~--~----~
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