I don’t have a proof of concept either but if somebody is going to put some effort into writing a new library I had a great idea they could incorporate. Continuing the ‘decomplecting’ that James started, the other thing that is decomplected (or actually not addressed at all) is _why_ we want logging to be produced. For me, I often want to see WARNING and above all the time and only see INFO and below if something interesting happened. ‘Interesting’ typically being an exception happened.
My notion was to add an adapter which at some point (e.g. around the use-case service/transaction boundary) started collecting all the logs in-memory and if the service executed correctly would simply drop the INFO and below messages. However, if the service aborted (e.g. threw an Exception) only then would the INFO and below logs get written to disk. It’s so simple and useful I can’t believe nobody else has already written it. My excuse is good old time. Clojure, Agents, robert-hooke - couldn’t be easer. > On 27 Jul 2015, at 08:28, crocket <crockabisc...@gmail.com> wrote: > > Can I see your proof of concept on github? Is it just an idea? > > On Mon, Jul 27, 2015 at 2:27 PM, James Reeves <ja...@booleanknot.com > <mailto:ja...@booleanknot.com>> wrote: >> On 27 July 2015 at 05:25, crocket <crockabisc...@gmail.com> wrote: >>> >>> How those logs are outputted is stored in a global state called log >>> configuration. So, I think the separation was done. >>> How else do you want to separate that? >> >> >> Traditionally, logging code is written something like: >> >> (log/info "HTTP request to" (:request-method req) (:uri req)) >> >> So the priority of the log (info) and the formatting of the log line is >> inlined into the source code. >> >> A less complected piece of code would separate out what we want to monitor >> (req) from how we monitor it. So inline we just write: >> >> (monitor/monitor req :ring/request) >> >> This monitors the variable req and associates it with the namespaced keyword >> :ring/request. In our logging namespace, we can then later define how we >> want to report on that monitor: >> >> (monitor/add-reporter >> :ring/request >> (fn [req] (log/info "HTTP request to" (:request-method req) (:uri >> req)))) >> >> This separates *what* we want to monitor from *how* we eventually log it. It >> means we can do things like define a set of useful monitoring points in a >> library, and then in a separate application decide on what's important. >> >> - James >> >> -- >> 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 >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "Clojure" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/clojure/9YiGAp6axcY/unsubscribe >> <https://groups.google.com/d/topic/clojure/9YiGAp6axcY/unsubscribe>. >> To unsubscribe from this group and all its topics, send an email to >> clojure+unsubscr...@googlegroups.com >> <mailto:clojure+unsubscr...@googlegroups.com>. >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. > > -- > 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 > <mailto: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 > <mailto:clojure+unsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > <http://groups.google.com/group/clojure?hl=en> > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com > <mailto:clojure+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.