*print-err-fn*

dynamic varsince v1.7.10Edit

A var representing the function used to print error output, which may differ between runtime environments. Use enable-console-print! to set it to print to console/stderr, then bind as follows:

(enable-console-print!)
(binding [*print-fn* *print-err-fn*]
  (println "printed to stderr in Node, or to browser console as error"))

Details:

This is meant to replace a use-case of Clojure's *err* var, allowing you to print things to stderr using the print function.

;; Clojure
(binding [*out* *err]
  (println "error"))

;; ClojureScript
(binding [*print-fn* *print-err-fn*]
  (println "error"))

See Also:


Source docstring:
Each runtime environment provides a different way to print error output.
Whatever function *print-err-fn* is bound to will be passed any
Strings which should be printed.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defonce
  ^{:doc "Each runtime environment provides a different way to print error output.
  Whatever function *print-err-fn* is bound to will be passed any
  Strings which should be printed." :dynamic true}
  *print-err-fn* nil)