Skip to content

Commit c6e0065

Browse files
silence the rawtapper by default
1 parent ecbe871 commit c6e0065

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ jobs:
1212
- run: npm ci
1313
- run: npm run lint || true
1414
- run: npm test
15-
- run: npm run build

src/api/rendezvous.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
import { getLogger } from "../util/logger.js";
22

3-
// Tolerant rendezvous client for dev/prod brokers.
4-
//
5-
// Accepts multiple response shapes:
6-
// - JSON: { code, appID } or { code } or { data: { code, appID } } etc.
7-
// - text/plain: "CODE", "code: CODE", or "CODE APPID"
8-
// If appID is missing, we fall back to appID === code.
9-
//
10-
// Endpoints tried (first that succeeds wins):
11-
// create: /rendezvous/code, /rendezvous/create, /code
12-
// redeem: /rendezvous/redeem, /redeem, /code/redeem
13-
//
14-
// With NT_DEBUG=1, we log the HTTP status and first 200 chars of the body.
15-
163
const debug = (...args) => getLogger().debug(args.join(" "));
174

185
function normApiBase(apiBase) {

src/commands/raw_tap.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// raw_tap.js
21
const RAW_TAP = Symbol.for("nt.rawTapAttached");
2+
const DEBUG = !!process.env.NT_DEBUG;
33

44
export function attachRawLogger(
55
tx,
@@ -11,6 +11,12 @@ export function attachRawLogger(
1111
) {
1212
if (tx[RAW_TAP]) return () => {};
1313

14+
Object.defineProperty(tx, RAW_TAP, { value: true, enumerable: false });
15+
16+
if (!DEBUG) {
17+
return () => {};
18+
}
19+
1420
// Track order/dupes per stream (sid)
1521
const lastSeq = new Map(); // sid -> last seq seen
1622
const frames = new Map(); // sid -> count
@@ -92,7 +98,5 @@ export function attachRawLogger(
9298
}
9399
});
94100

95-
Object.defineProperty(tx, RAW_TAP, { value: true, enumerable: false });
96-
97101
return () => { try { off?.(); } catch {} try { if (origSend) tx.send = origSend; } catch {} };
98102
}

0 commit comments

Comments
 (0)