Fork me on GitHub
#graphql
<
2022-03-10
>
hlship21:03:32

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

👍 5
Jungwoo Kim09:10:03

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 ??

hlship21:10:41

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.

hlship21:10:59

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

hlship21:10:27

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.

hlship21:10:12

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

hlship21:10:32

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

Jungwoo Kim12:10:15

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.

Jungwoo Kim12:10:35

Do I understand something wrong?