lambdaisland / glogi

A ClojureScript logging library based on goog.log
Mozilla Public License 2.0
119 stars 13 forks source link

log/console-autoinstall! always accumulates #2

Closed torkus closed 3 years ago

torkus commented 4 years ago

Both of these approaches to installing the console log event handler just once in an environment where figwheel reloads code fails. The log messages are repeated N times for each subsequent code reload:

(defonce on-initial-load
  (do
    (log/console-autoinstall!)
    true)))
(events/listen js/window "load"
               (fn [_]
                 (log/console-autoinstall!)))

examples taken from here: https://figwheel.org/docs/reloadable_code.html

plexus commented 4 years ago

Figwheel installs its own handler, so console-autoinstall! shouldn't be needed when using Figwheel. Not sure why it's being added twice, this might be an unintended interplay between the handler that Figwheel installs and the one added by Glogi.