(defonce
^{:doc "Each runtime environment provides a different way to print output.
Whatever function *print-fn* is bound to will be passed any
Strings which should be printed." :dynamic true}
*print-fn* nil)
luminus leaves it on in dev and disables it for prod:
(set! *print-fn* (fn [& _]))
how does one reason about the performance implications of this?.. i mean… basically the intent should be to ignore println in prod, right?.. but ignoring large args like that can be pretty expensive… so i was wondering if something ( not too hackish ) could be done to ameliorate this situation.
Don’t forget with-out-str! To “ignore println in prod” could break things. Nonetheless, it is interesting that the “pr” functions assemble the string before checking whether a *print-fn* exists to receive it. You could make your own debug-print function, of course.