#63: goog.log/error for logging cljs errors
This commit is contained in:
parent
2f51e5049e
commit
355b9b3ea3
2 changed files with 7 additions and 5 deletions
|
|
@ -105,11 +105,11 @@
|
|||
[state {:keys [stop status] :as current} done]
|
||||
(when (some status #{:started})
|
||||
(if stop
|
||||
(if-let [error (-> (on-error (str "could not stop [" state "] due to")
|
||||
(if-let [cause (-> (on-error (str "could not stop [" state "] due to")
|
||||
(record! state stop done)
|
||||
:fail? false)
|
||||
:f-failed)]
|
||||
(log error) ;; this would mostly be useful in REPL
|
||||
(log cause :error) ;; this would mostly be useful in REPL / browser console
|
||||
(alter-state! current (NotStartedState. state)))
|
||||
(alter-state! current (NotStartedState. state))) ;; (!) if a state does not have :stop when _should_ this might leak
|
||||
(swap! running dissoc state)
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@
|
|||
(glog/getLogger "mount"))))
|
||||
|
||||
#?(:clj
|
||||
(defn log [msg]
|
||||
(defn log [msg & _]
|
||||
(prn msg)))
|
||||
|
||||
#?(:cljs
|
||||
(defn log [msg]
|
||||
(glog/info *logger* msg)))
|
||||
(defn log [msg & level]
|
||||
(case (first level)
|
||||
:error (glog/error *logger* msg)
|
||||
(glog/info *logger* msg))))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue