From 587b3e015f546a9415cba4e523f4bf2f01c624b3 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Fri, 19 Aug 2016 09:59:53 +0700 Subject: [PATCH] [#188] Hotfix: regression re: interleaving println --- src/taoensso/timbre/appenders/core.cljx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/taoensso/timbre/appenders/core.cljx b/src/taoensso/timbre/appenders/core.cljx index 73564b28..e7a37ed3 100644 --- a/src/taoensso/timbre/appenders/core.cljx +++ b/src/taoensso/timbre/appenders/core.cljx @@ -20,6 +20,12 @@ taoensso.timbre/default-err) #+clj (alias 'timbre 'taoensso.timbre) +#+clj +(def ^:private ^:const system-newline + (System/getProperty "line.separator")) + +#+clj (defn- atomic-println [x] (print (str x system-newline)) (flush)) + (defn println-appender "Returns a simple `println` appender for Clojure/Script. Use with ClojureScript requires that `cljs.core/*print-fn*` be set. @@ -53,7 +59,9 @@ :*err* *err* stream)] - (binding [*out* stream] (println (force output_))))))})) + (binding [*out* stream] + #+clj (atomic-println (force output_)) + #+cljs (println (force output_))))))})) (comment (println-appender))