cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
plexus 2021-03-08T14:37:00.070900Z

does anyone know what could be happening here, in a directory with nothing but this deps.edn pointing at clojurescript at latest master

{:deps {org.clojure/clojurescript {:local/root "/path/to/clojurescript"}}}
I get
➜ clj -m cljs.main --repl-env node
WARNING: When invoking clojure.main, use -M
ClojureScript 0.0.2008668038
cljs.user=> 
It seems to be picking up some ancient version of ClojureScript? clj -Stree looks fine.

plexus 2021-03-08T14:42:37.071300Z

ah seems to be better after a script/build

mikejcusack 2021-03-08T14:43:10.071400Z

I see this as well in the REPL, but in the actual dependencies it's the correct version.

alexmiller 2021-03-08T14:51:18.072800Z

you're probably just picking up a resource file that stores the ClojureScript version that is old would be my guess

plexus 2021-03-08T14:52:33.073800Z

Looking at the goog.log changes for Glögi (https://github.com/lambdaisland/glogi/), seems several instance methods have become static methods/functions

(.setLevel logger level)  ->  (glog/setLevel logger level)
(.addHandler logger handler) -> (glog/addHandler logger level)
(.logRecord logger record)  ->  (glog/publishLogRecord logger record)

plexus 2021-03-08T14:53:31.074400Z

(require '[goog.log :as glog])

👍 1
borkdude 2021-03-08T14:54:02.075100Z

now the name of your library makes even more sense

plexus 2021-03-08T14:54:32.075600Z

If I want to support both I guess I can do a (exists? glog/publishLogRecord) etc. Unless someone has a better idea 🙂

dnolen 2021-03-08T14:54:56.075800Z

dynamic check seems best

mikejcusack 2021-03-08T14:55:02.075900Z

Yes, and also calling the log functions themselves has changed

mikejcusack 2021-03-08T14:56:05.076100Z

I'm seeing this when using master as a git dep as well. Where would that resource file be?

alexmiller 2021-03-08T14:57:38.076300Z

local/git deps are basically used the same way. don't know, just guessing

👌 1
alexmiller 2021-03-08T14:58:52.076600Z

just in general, projects with build steps do not play well (yet!) as local/git deps, and cljs is certainly such a project

👌 1
plexus 2021-03-08T15:04:39.078200Z

while I'm here let me also warmly encourage people to use Glögi (or goog.log) in their projects/libraries. It is really nice to get consistent logging and be able to control log levels all in one place

(log/set-levels
 '{:glogi/root :debug
   lambdaisland :all
   co.gaiwan.some.ns :warn
   some.library :info})

👍 1
mkvlr 2021-03-08T15:06:16.078900Z

@kommen didn’t you open a PR?

mkvlr 2021-03-08T15:06:56.079700Z

@plexus I guess not yet but here’s the commit https://github.com/nextjournal/glogi/commit/d17e48da78f2ae24938104b7ee2567023b9bc007

kommen 2021-03-08T15:11:01.080Z

opened a draft https://github.com/lambdaisland/glogi/pull/8

plexus 2021-03-08T15:15:09.080300Z

thanks, but I was nearly there. I'd like to retain backwards compatibility at least for a while.

mikejcusack 2021-03-08T15:15:50.080500Z

So if you do a log/info in lambdaisland it will override to :all?

mikejcusack 2021-03-08T15:27:26.080700Z

It's not clear in the README how that behavior is supposed to work. The example does a log in the root namespace. It would be helpful to have an example in one of the defined namespaces.

plexus 2021-03-08T15:31:04.080900Z

it follows the rules of goog.log or pretty much any logging library out there, if there's a log level defined for a given logger it uses that, otherwise it goes up the hierarchy.

plexus 2021-03-08T15:32:46.081100Z

{foo :info
 foo.bar :warn
 foo.bar.baz :debug
 :glogi/root :error}
- foo.bar.baz -> debug - foo.bar.baz.baq -> also debug (traverses to the parent logger, which has an explicit level) - http://foo.bar.xxx -> :warn - some.other.logger -> :error (no level for some.other, no level for some, so it uses the root level)

mikejcusack 2021-03-08T15:33:04.081300Z

So it would be good for someone that hasn't used that to be in the README. 🙂

plexus 2021-03-08T15:33:25.081500Z

doc PRs are always welcome!

mikejcusack 2021-03-08T15:33:40.081700Z

Since the documentation for goog.log isn't very clear as you mentioned

mikejcusack 2021-03-08T15:33:57.081900Z

Documentation provided by someone whom has never used the library doesn't make any sense to me.

plexus 2021-03-08T15:34:08.082100Z

maybe just linking to something like http://tutorials.jenkov.com/java-logging/logger-hierarchy.html

mikejcusack 2021-03-08T15:41:32.082400Z

So then according to that article the answer to my original question is no. It just sets the filter level. You still have to call the appropriate goog.log function. So I'm failing to see why this is any better than just calling the log function you want for the given thing you are logging.

plexus 2021-03-08T15:55:31.082600Z

I don't follow. You put logging in your code at the appropriate level for what you're logging, log/trace for highly detailed debug stuff, log/error for exceptional situations. Then you can use the hierarchies for fine grained control of how much detail you want to see for a given tree of namespaces/loggers at a given time.

plexus 2021-03-08T15:56:01.082800Z

see Layer your Logging https://lambdaisland.com/blog/2020-09-28-logging-in-practice-glogi-pedestal

borkdude 2021-03-08T17:18:56.083600Z

Is there any coordination with the JVM team when adding things to cljs.core, e.g. about the function iter, etc? For context: https://ask.clojure.org/index.php/10303/interop-clojure-pattern-clojure-consider-adding-iter-clojure