    [cljs.core.async.macros :refer [go go-loop]]
    [figwheel.client :refer [defonce]]))
 
-(def log-style "color:rgb(0,128,0);")
-
 (defn log [{:keys [debug]} & args]
   (when debug
     (.log js/console (to-array args))))

(def format-messages (comp (partial map error-msg-format) get-essential-messages))

(defn default-on-compile-fail [{:keys [formatted-exception exception-data] :as ed}]
  (.log js/console "%cFigwheel: Compile Exception" log-style)
  (doseq [msg (format-messages exception-data)]
    (.log js/console msg))
  ed)

(defn default-before-load [files]
  (.log js/console "%cFigwheel: loading files" log-style)
  #_(.log js/console (prn-str (mapv :file files)))
  files)

(defn default-on-cssload [files]
  (.log js/console "%cFigwheel: loaded CSS files" log-style)
  (.log js/console (prn-str (map :file files)))
  files)


(defn watch-and-reload* [{:keys [retry-count websocket-url
                                 jsload-callback
                                 on-compile-fail] :as opts}]
    (.debug js/console "Figwheel: trying to open cljs reload socket")  
    (let [socket (js/WebSocket. websocket-url)]
      (set! (.-onmessage socket) (fn [msg-str]
                                   (let [msg (read-string (.-data msg-str))]
