|
15 | 15 | (:require-macros
|
16 | 16 | [cljs.core.async.macros :as asyncm :refer [go go-loop]]))
|
17 | 17 |
|
18 |
| -;; (timbre/set-level! :trace) ; Uncomment for more logging |
| 18 | +;;;; Logging config |
| 19 | + |
| 20 | +(sente/set-min-log-level! :info) ; Min log level for internal Sente namespaces |
| 21 | +(timbre/set-ns-min-level! :info) ; Min log level for this namespace |
19 | 22 |
|
20 | 23 | ;;;; Util for logging output to on-screen console
|
21 | 24 |
|
22 | 25 | (def output-el (.getElementById js/document "output"))
|
23 | 26 | (defn ->output! [fmt & args]
|
24 | 27 | (let [msg (apply encore/format fmt args)]
|
25 |
| - (timbre/debugf "->output: %s" msg) |
26 |
| - (aset output-el "value" (str "• " (.-value output-el) "\n" msg)) |
| 28 | + ;; (timbre/tracef "->output: %s" msg) |
| 29 | + (aset output-el "value" (str (.-value output-el) "\n• " msg)) |
27 | 30 | (aset output-el "scrollTop" (.-scrollHeight output-el))))
|
28 | 31 |
|
29 | 32 | (->output! "ClojureScript appears to have loaded correctly.")
|
|
140 | 143 | (when-let [target-el (.getElementById js/document "btn5")]
|
141 | 144 | (.addEventListener target-el "click"
|
142 | 145 | (fn [ev]
|
143 |
| - (->output! "Disconnecting") |
| 146 | + (->output! "Disconnecting...\n\n") |
144 | 147 | (sente/chsk-disconnect! chsk))))
|
145 | 148 |
|
146 | 149 | (when-let [target-el (.getElementById js/document "btn6")]
|
147 | 150 | (.addEventListener target-el "click"
|
148 | 151 | (fn [ev]
|
149 |
| - (->output! "Reconnecting") |
| 152 | + (->output! "Reconnecting...\n\n") |
150 | 153 | (sente/chsk-reconnect! chsk))))
|
151 | 154 |
|
152 | 155 | (when-let [target-el (.getElementById js/document "btn-login")]
|
|
156 | 159 | (if (str/blank? user-id)
|
157 | 160 | (js/alert "Please enter a user-id first")
|
158 | 161 | (do
|
159 |
| - (->output! "Logging in with user-id %s" user-id) |
| 162 | + (->output! "Logging in with user-id %s...\n\n" user-id) |
160 | 163 |
|
161 | 164 | ;;; Use any login procedure you'd like. Here we'll trigger an Ajax
|
162 | 165 | ;;; POST request that resets our server-side session. Then we ask
|
|
0 commit comments