docs(spikes): Deno 2.9.7 + TS 7 compatibility spike and ADR-004
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
1 parent
fe3613ee8f
commit
cf85481d95
147 files changed
+15213
No files matched your search
@@ -0,0 +1,12 @@
|
||||
// LogTape alternative: JSON lines + redaction sink wrapper.
|
||||
import { configure, getJsonLinesFormatter, getLogger, getStreamSink, type LogRecord, type Sink } from "@logtape/logtape";
|
||||
import { redact, redactString } from "@spike/x";
|
||||
|
||||
const base = getStreamSink(Deno.stdout.writable, { formatter: getJsonLinesFormatter() });
|
||||
const redacting = (inner: Sink): Sink => (r: LogRecord) =>
|
||||
inner({ ...r, message: r.message.map((m: unknown) => (typeof m === "string" ? redactString(m) : redact(m))), rawMessage: typeof r.rawMessage === "string" ? redactString(r.rawMessage) : r.rawMessage, properties: redact(r.properties) as Record<string, unknown> });
|
||||
await configure({ sinks: { out: redacting(base) }, loggers: [{ category: ["umt"], lowestLevel: "info", sinks: ["out"] }, { category: ["logtape", "meta"], lowestLevel: "warning", sinks: ["out"] }] });
|
||||
const log = getLogger(["umt", "worker"]);
|
||||
log.info("fetch {url}", { url: "https://x/rss?passkey=SECRET", token: "abc", n: 3 });
|
||||
log.with({ runId: "r1", apiKey: "k" }).warn("child context");
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
Reference in new issue
Block a user