Files
discord-decomp/_bundle/Module6453.js
T
2026-11-01 12:12:55 +02:00

57 lines
2.1 KiB
JavaScript

// Metro module 6453 (f6454).
import * as _consoleSandbox from "./consoleSandbox_6368";
import { GLOBAL_OBJ } from "./Module6369";
import { addConsoleInstrumentationHandler } from "./instrumentConsole_6454";
import { getClient, withScope } from "./Module6395";
import { defineIntegration } from "./setupIntegration_6424";
import { severityLevelFromString } from "./Module6455";
import { addExceptionMechanism } from "./Module6379";
import { safeJoin } from "./Module6377";
import { captureException, captureMessage } from "./endSession";
export const captureConsoleIntegration = defineIntegration(function(r1 = {}) {
const CONSOLE_LEVELS = r1.levels || _consoleSandbox.CONSOLE_LEVELS;
let c15749_1 = !!r1.handled;
return {
name: "CaptureConsole",
setup: (c25884_0) => {
if ("console" in GLOBAL_OBJ) {
addConsoleInstrumentationHandler(({ args: args2, level: level2 }) => {
if (getClient() === c25884_0 && CONSOLE_LEVELS.includes(level2)) {
const args = args2;
const level = level2;
const handled = c15749_1;
let c29775_3 = {
level: severityLevelFromString(level),
extra: {
arguments: args
}
};
withScope((a0) => {
a0.addEventProcessor((a0) => {
a0.logger = "console";
addExceptionMechanism(a0, {
handled,
type: "console"
});
return a0;
});
if (level !== "assert") {
const r42 = args.find((arg) => arg instanceof Error);
if (r42) {
captureException(r42, c29775_3);
} else {
captureMessage(safeJoin(args, " "), c29775_3);
}
} else if (!args[0]) {
const r26 = `Assertion failed: ${safeJoin(args.slice(1), " ") || "console.assert"}`;
a0.setExtra("arguments", args.slice(1));
captureMessage(r26, c29775_3);
}
});
}
});
}
}
};
});