Clojure: log to console when code is being executed in a go block or thread
问题 With many go blocks going at once, all writing to the console, the text can get jumbled/intermingled when it arrives at the console. How to avoid this, so trace output forms as correctly in the console as intended when it was emitted from within the go block? 回答1: This answer uses core.async itself. The following from a talk: ;;;;; Logging Handler ;;;;; (def log-chan (chan)) (thread (loop [] (when-let [v (<!! log-chan)] (println v) (recur))) (println "Log Closed")) (close! log-chan) (defn log