This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-13
Channels
- # admin-announcements (1)
- # announcements (40)
- # aws (2)
- # babashka (46)
- # babashka-sci-dev (106)
- # beginners (31)
- # cider (5)
- # circleci (2)
- # clj-kondo (48)
- # clojure (118)
- # clojure-belgium (1)
- # clojure-chicago (3)
- # clojure-europe (19)
- # clojure-ireland (3)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-spec (10)
- # clojure-uk (4)
- # clojurescript (18)
- # community-development (5)
- # core-async (159)
- # cursive (16)
- # datomic (16)
- # etaoin (1)
- # fulcro (21)
- # funcool (14)
- # graalvm (5)
- # gratitude (4)
- # holy-lambda (28)
- # jobs (1)
- # jobs-discuss (1)
- # kaocha (1)
- # lsp (12)
- # malli (21)
- # meander (12)
- # music (1)
- # off-topic (8)
- # portal (5)
- # react (18)
- # reitit (1)
- # releases (4)
- # remote-jobs (1)
- # shadow-cljs (56)
- # timbre (4)
Hi there. I appear to be losing my timbre logging context inside a manifold chain
fn, which I believe is executed in a separate thread. Any idea how I might keep that logging context so that I can log inside these fns?
use bound-fn
instead of fn
the logging context is a dynamic bound variable, which is a thread local binding. when you do chain
, it will kick off the function on a different thread & you’ll lose any thread local bindings. bound-fn
will create the fn
and preserve those
personally, for most use cases, I recommend simply using the go-off
macro instead of directly using chain
. It automatically keeps thread local bindings so you don’t have to worry about it yourself
see https://github.com/clj-commons/manifold/blob/master/doc/deferred.md#go-off