aroemers / mount-lite

mount, but different and light
https://cljdoc.org/d/functionalbytes/mount-lite/
Eclipse Public License 1.0
102 stars 8 forks source link

Add optional logging namespace, utilising robert-hooke library? #4

Closed aroemers closed 8 years ago

aroemers commented 8 years ago

A nice thing about https://github.com/tolitius/mount is that it uses robert-hooke for optional logging. I think it is mostly the responsibility of the defstates start and stop expressions to log, but having an optional namespace that adds some debug logging might be nice to have.

Maybe a public function like this?

(defn basic-logging
  "Enables basic logging of starting and stopping states. One can supply a 2-arity 
  function which will receive either :starting or :stopping as its first argument and
  the state var as its second argument. Default prints a simple statement to *out*."
  ([] 
   (basic-logging #(println "[mount]" (case %1 :starting ">>> starting" :stopping "<<< stopping") %2)))
  ([f] 
   ...install hooks ...))
aroemers commented 8 years ago

Added in 0.9.8, using a function called log-fn.