graphql 2022-03-10

I’ve extracted the trace code to an entirely new library: https://github.com/hlship/trace

👍 5

Thank you for your replies. The first one is clear ! > But for arbitrary third-party lib X, unless X uses trace and left that in their code, no luck. But the second question is a bit confusing. In my case, my lib X which uses trace and left that in their code and my project A uses trace and lib X. So as I work for the project A and turn on tracing on to see lib X’s trace. but I can’t see any output of X’s trace even though trace is left in lib X.

Do I understand something wrong?

Hi hlship! I’m interested in the trace library and have a question! 1. https://github.com/hlship/trace/blob/main/src/net/lewisship/trace.clj#L41 says we need to reload ns but https://github.com/hlship/trace/blob/main/src/net/lewisship/trace.clj#L48 is affected immediately. Is there any diffrence between two? 2. Plus, the problem I faced is I’d like to add trace https://github.com/green-labs/gosura/pull/63/files#diff-fdc1a1bab3cb05abb3c25796f6278f786704f20cf49750c1eee31d966105d9c1R195 and I setup default of trace in the other project(A project) I use that repo. but trace including sql doesn’t work on A project. How do I trace to exteral library using trace in my project using trace ??

trace is for your own code. You can add calls to trace and it will build a useful map that it passed to Clojure's tap> . In terms of reloading, the trace macro has two modes: When not compiled, it is a no-op. When compilation is enabled, there's still a check against a global flag to see if tracing is enabled.

So in production code, you can leave in the trace code but not set the compile flag, and your code is unaffected.

But when testing locally, you can set the compile flag before loading your namespaces and then turn tracing on and off globally as you work.

Perhaps a future version of the lib will allow the enabled check to be per-namespace.

But for arbitrary third-party lib X, unless X uses trace and left that in their code, no luck.