feat: add diagnostics and telemetry runtime
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export function leakToConsole(token: string) {
|
||||
console.error("UNKNOWN_DIAGNOSTIC_EVENT", token);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export function leakSensitiveContext(telemetry: {
|
||||
emit(eventName: string, context: Record<string, unknown>): void;
|
||||
}) {
|
||||
telemetry.emit("api.request.failed", {
|
||||
authorization: "Bearer secret",
|
||||
request_body: { email: "private@example.test" },
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { DiagnosticsPort } from "../../../src/application/ports/diagnostics-port.js";
|
||||
import type { TelemetryPort } from "../../../src/application/ports/telemetry-port.js";
|
||||
|
||||
declare const diagnostics: DiagnosticsPort;
|
||||
declare const telemetry: TelemetryPort;
|
||||
|
||||
diagnostics.record({
|
||||
level: "fatal",
|
||||
eventId: "UNKNOWN_DIAGNOSTIC_EVENT",
|
||||
});
|
||||
telemetry.emit("unknown.telemetry.event", {});
|
||||
Reference in New Issue
Block a user