h2. steps to reproduce
Given
{code:title=deps.edn}
{:paths
["."]
:deps
{org.clojure/clojurescript {:mvn/version "1.10.339"
#_#_:git/url "
https://github.com/clojure/clojurescript.git"
#_#_:sha "6eedd0a08c49f7b0d4dcb30977b2fb38c90577bd"}}}
{code:title=foo.cljs}
(ns foo
(:require [goog.log :as glog])
(:import goog.debug.Console))
(def logger
(glog/getLogger "app"))
(def console (goog.debug.Console.))
(defn workaround! []
(.setConsole goog.debug.Console js/console))
(defn -main [& args]
(.setCapturing console true)
(.setLevel logger goog.debug.Logger.Level.FINEST)
(when args
(workaround!))
(glog/error logger "some error"))
(set! *main-cli-fn* -main)
When I compile with optimization `none` and run, logging does appear:
$ clj -m cljs.main -v -O none -t node -c foo
$ node out/main.js
[ 0.002s] [app] some error
When I compile with optimization `simple` (or `advanced`) and run, logging does *not* appear.
Expected: optimization simple should have no effect on appearance of logging on Node (just like when compiling for the browser).
h2. various (FWIW)
With simple, `goog.debug.Console.console_` ends up being nil as `goog.global['console']` is nil (
https://github.com/google/closure-library/blob/master/closure/goog/debug/console.js#L169).
`println` works in both none and simple.
When targetting browser both none and simple show logging.
A workaround is to setConsole: `(.setConsole goog.debug.Console js/console)`