UP | HOME

Clojure log helpers

Table of Contents

These are helpful functions I use for debugging in Clojure and ClojureScript.

Just call log with any number of strings as arguments.

1 Clojure

(defn log
  "concatenate and save to file"
  [& strings]
  (spit "/tmp/cljdebug.txt" (str (reduce str strings) "
")))  

2 ClojureScript

(defn log
  "concatenate and print to console"
  [& strings]
  ((.-log js/console) (reduce str strings)))

Copyright 2023 Joseph Graham (joseph@xylon.me.uk)