Skip to content

Commit 9cf1153

Browse files
Make tracing trait opt-out via env only
1 parent 86085f3 commit 9cf1153

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
SWIFT_SDK_ID ?=
2+
DISABLE_TRACING ?= $(JAVASCRIPTKIT_DISABLE_TRACING_TRAIT)
23

34
.PHONY: bootstrap
45
bootstrap:
@@ -11,7 +12,7 @@ unittest:
1112
echo "SWIFT_SDK_ID is not set. Run 'swift sdk list' and pass a matching SDK, e.g. 'make unittest SWIFT_SDK_ID=<id>'."; \
1213
exit 2; \
1314
}
14-
ifeq ($(JAVASCRIPTKIT_DISABLE_TRACING_TRAIT),1)
15+
ifeq ($(DISABLE_TRACING),1)
1516
TRACING_ARGS :=
1617
else
1718
TRACING_ARGS := --traits Tracing

Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,18 +338,18 @@ func _call_host_function_impl(
338338
guard let entry = JSClosure.sharedClosures.wrappedValue[hostFuncRef] else {
339339
return true
340340
}
341-
#if Tracing
341+
#if Tracing
342342
let traceEnd = JSTracingHooks.beginJSClosureCall(
343343
JSTracing.JSClosureCallInfo(fileID: entry.fileID, line: UInt(entry.line))
344344
)
345-
#endif
345+
#endif
346346
var arguments: [JSValue] = []
347347
for i in 0..<Int(argc) {
348348
arguments.append(argv[i].jsValue)
349349
}
350-
#if Tracing
350+
#if Tracing
351351
defer { traceEnd?() }
352-
#endif
352+
#endif
353353
let result = entry.body(arguments)
354354
let callbackFuncRef = JSObject(id: callbackFuncRef)
355355
_ = callbackFuncRef(result)

0 commit comments

Comments
 (0)