bug report tool — screenshot, console logs, and context sent to discord

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 18:09:51 +00:00
co-authored by Claude Opus 4.6
parent 30f06e91e4
commit 74ace56120
10 changed files with 315 additions and 0 deletions
@@ -0,0 +1,37 @@
type LogLevel = 'log' | 'warn' | 'error';
type LogEntry = {
level: LogLevel;
message: string;
timestamp: number;
};
const MAX_ENTRIES = 100;
const buffer: LogEntry[] = [];
const originalLog = console.log;
const originalWarn = console.warn;
const originalError = console.error;
function pushEntry(level: LogLevel, args: unknown[]) {
const message = args.map((a) => (typeof a === 'string' ? a : JSON.stringify(a))).join(' ');
buffer.push({ level, message, timestamp: Date.now() });
if (buffer.length > MAX_ENTRIES) buffer.shift();
}
console.log = (...args: unknown[]) => {
pushEntry('log', args);
originalLog.apply(console, args);
};
console.warn = (...args: unknown[]) => {
pushEntry('warn', args);
originalWarn.apply(console, args);
};
console.error = (...args: unknown[]) => {
pushEntry('error', args);
originalError.apply(console, args);
};
export const getConsoleBuffer = (): LogEntry[] => [...buffer];