This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-06
Channels
- # announcements (5)
- # asami (4)
- # babashka (27)
- # beginners (1)
- # calva (4)
- # cider (64)
- # clj-kondo (7)
- # clojure (7)
- # clojure-brasil (3)
- # clojure-europe (41)
- # clojure-france (2)
- # clojure-norway (101)
- # clojure-uk (5)
- # clojurescript (19)
- # cursive (3)
- # datahike (15)
- # datomic (15)
- # events (2)
- # honeysql (11)
- # hyperfiddle (27)
- # introduce-yourself (2)
- # jobs-rus (1)
- # leiningen (8)
- # london-clojurians (1)
- # lsp (175)
- # off-topic (52)
- # overtone (10)
- # portal (15)
- # re-frame (7)
- # reagent (1)
- # releases (1)
- # remote-jobs (2)
- # shadow-cljs (15)
- # sql (5)
I'm up to no good again, which also means I'm in the sort of trouble that only the Clojurians hivemind can solve. It seems that the clojure.tools.logging
support in babashka doesn't provide clojure.tools.logging.test
, so I thought I'd be clever and stuff https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/test.clj into my project. Not so clever, it turns out, because when I try to eval it, I get a lovely exception:
clojure.lang.ExceptionInfo: Could not resolve symbol: impl/LoggerFactory
{:type :sci/error, :line 202, :column 3, :message "Could not resolve symbol: impl/LoggerFactory", ...}
at sci.impl.utils$rethrow_with_location_of_node.invokeStatic (utils.cljc:129)
sci.impl.utils$rethrow_with_location_of_node.invoke (utils.cljc:93)
I've dropped the full exception into a https://gist.github.com/jmglov/bcb9f7bf8b5cdbdbab143bdff31c401a.
Does anyone have a clue what's going on here and how to make it work? I'll keep poking in the meantime, but I imagine someone here will slap me upside the head with the solution before I bang my head against the wall enough that it crumbles (the wall, not my head—I hope!) and reveals the truth beyond.babashka uses timbre for loggign I believe, because it's a clojure logging library. clojure.tools.logging being a facade does pull in some code for implementations - which are java based. being java baased they can't work with bb unless they are compiled in - which will increase size of bb binary
"Support for testing whether logging calls are made.> > Usage example: > (require '[clojure.tools.logging :as log] > '[clojure.tools.logging.test :refer [logged? with-log]) > (with-log > (log/info \"Hello World!\") > (log/error (Exception. \"Did a thing\") \"Error: oops\") > (logged? 'user :info #\"Hello\") ; true > (logged? 'user :error [Throwable #\"thing\"] #\"Error:\") ; true > (logged? 'user :debug \"Hi\")) ; false"}
I'm mostly asking @U054AT6KT here since he's the one who tried to use it in bb ;)
It’s not crucial, but I was looking at using it in awyeah-api, as I’m porting across the new changes that have been made in aws-api.
Since bb includes clojure.tools.logging, it was just surprising that c.t.l.test wasn’t available. Not a big deal; I can certainly live without it.
https://clojurians.slack.com/archives/C8NUSGWG6/p1699699490228429 is what I was up to. 😬
hehe great. using clojure.data.json is fine, but it 1) is much much slower than using a built-in JSON client, so for big payloads, I don't recommend this approach and 2) it affects startup time since it has to load/process all of that code too
using a reader condition or a if-bb
macro would be good if you want to optimize this
awyeah (and by extension, awno) uses bb’s built-in Cheshire and the java.net.http stuff that’s baked into bb as well.
I’m not sure why Cognitect’s aws-api uses clojure.data.json. Maybe they reckon that payloads returned by AWS API calls aren’t too large. :man-shrugging::skin-tone-3:
since the overhead of reading a file character by character is just way too much interpreter overhead
Replacing bash scripts with babashka scripts feels so rewarding 💯
One of my favourite bash rewrites: https://github.com/babashka/babashka/pull/1239 which incidentally caused one of our more severe incidents 😅 hence more memorable 😆
Worth it just alonw for reader comments. I find myself prefixing optional shell args with #_ and it doesnt work! :stuck_out_tongue:
It should work anywhere no? In ALL languages