Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting goog.DEBUG to false crashes figwheel-main #237

Open
achikin opened this issue Feb 28, 2020 · 1 comment
Open

Setting goog.DEBUG to false crashes figwheel-main #237

achikin opened this issue Feb 28, 2020 · 1 comment

Comments

@achikin
Copy link

achikin commented Feb 28, 2020

I've got the following stacktrace in the browser while starting figwheel

    at figwheel$repl$set_log_level (repl.cljc?rel=1582907261370:608)
    at figwheel$repl$init_log_level_BANG_ (repl.cljc?rel=1582907261370:617)
    at figwheel$repl$connect_STAR_ (repl.cljc?rel=1582907261370:620)
    at repl.cljc?rel=1582907261370:629
    at Function.cljs$core$IFn$_invoke$arity$variadic (repl.cljc?rel=1582907261370:629)
    at figwheel$repl$connect (repl.cljc?rel=1582907261370:627)
    at preload.cljs?rel=1582907261426:5
figwheel$repl$set_log_level @ repl.cljc?rel=1582907261370:608
figwheel$repl$init_log_level_BANG_ @ repl.cljc?rel=1582907261370:617
figwheel$repl$connect_STAR_ @ repl.cljc?rel=1582907261370:620
(anonymous) @ repl.cljc?rel=1582907261370:629
(anonymous) @ repl.cljc?rel=1582907261370:629
figwheel$repl$connect @ repl.cljc?rel=1582907261370:627
(anonymous) @ preload.cljs?rel=1582907261426:5
load (async)
(anonymous) @ preload.cljs?rel=1582907261426:5

It is produced by the following piece of code

  (if-let [lvl (get log-levels level)]
    (do
      (.setLevel logger' lvl)
      (debug (str "setting log level to " level)))
    (glog/warn (str "Log level " (pr-str level) " doesn't exist must be one of "
                    (pr-str '("severe" "warning" "info" "config" "fine" "finer" "finest"))))))

(defn init-log-level! []
  (doseq [logger' (cond-> [logger]
                    (exists? js/figwheel.core)
                    (conj js/figwheel.core.logger))]
    (set-log-level logger' client-log-level)))

As far as I can see from the browser console - figwheel.core.logger is null
image

@achikin
Copy link
Author

achikin commented Feb 28, 2020

I did some further exploration. This has happened because I had goog.DEBUG set to false in which case goog.log.getLogger returns null as per doc https://google.github.io/closure-library/api/goog.log.html#getLogger
getLogger return depends on goog.log.ENABLED which depends on goog.debug.LOGGING_ENABLED which depends on goog.DEBUG

@achikin achikin changed the title Logger init issue Setting goog.DEBUG to false crashes figwheel-main Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant