Re: Logging functions delegated to java logging systems

2009-07-27 Thread ataggart
Ok the patch file has been languishing on assembla for a few days, so I've uploaded it to the files section here if anyone wants to use the latest version. logging.clj at http://groups.google.com/group/clojure/files http://groups.google.com/group/clojure/files On Jul 23, 11:20 am, ataggart

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
Hmm, I like "spy" since it doesn't mimic a logging level like "debug" and "trace" do. Making the change now, thanks. On Jul 23, 11:01 am, Laurent PETIT wrote: > What about 'spy instead of 'debug ? Or 'trace ? > > 2009/7/23 ataggart > > > > > > > Tim is correct.  The log macro is what you wan

Re: Logging functions delegated to java logging systems

2009-07-23 Thread Laurent PETIT
What about 'spy instead of 'debug ? Or 'trace ? 2009/7/23 ataggart > > Tim is correct. The log macro is what you want to use when you're > really just wanting to log something; in that case the message > expression won't get evaluated unless the particular logging level is > enabled. > > The de

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
Tim is correct. The log macro is what you want to use when you're really just wanting to log something; in that case the message expression won't get evaluated unless the particular logging level is enabled. The debug function is for when you want to execute an expression regardless, but would a

Re: Logging functions delegated to java logging systems

2009-07-23 Thread Laurent PETIT
Thanks for the explanation, that makes sense. 2009/7/23 Timothy Pratley > > Hi Laurent, > > I believe using > (log :fine (expensive-calc)) > will do precisely what you describe (not do anything unless > level :fine is enabled, and return nil) > > (debug (some-expr)) is intended when you want

Re: Logging functions delegated to java logging systems

2009-07-23 Thread Timothy Pratley
Hi Laurent, I believe using (log :fine (expensive-calc)) will do precisely what you describe (not do anything unless level :fine is enabled, and return nil) (debug (some-expr)) is intended when you want to leave the logic precisely as is but display part of the calculation; (+ a b (- c d)) ;

Re: Logging functions delegated to java logging systems

2009-07-23 Thread Laurent PETIT
Hello, 2009/7/23 ataggart > > 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 m

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
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

Re: Logging functions delegated to java logging systems

2009-07-22 Thread ataggart
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 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

Re: Logging functions delegated to java logging systems

2009-07-22 Thread Tom Faulhaber
Yeah, I'd like to see something like this in clojure-contrib. One of the problems that java systems routinely have is mismatches between the assumed logging system. This is a real pain when it comes up and it would be nice to have that taken care of by an abstraction layer. Tom On Jul 21, 10:13 

Re: Logging functions delegated to java logging systems

2009-07-22 Thread Timothy Pratley
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/baf83e2bb26662f5f5049d165dec31e47b91e171/clj/timothypratley/logging.clj log-capt

Logging functions delegated to java logging systems

2009-07-21 Thread ataggart
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