Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/debugdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ export function setLogItem(str: string): void {
export async function getLogs(): Promise<void> {
if (db) {
const all = await db.getAll('logs' as never);
downloadString(all.join('\n'), 'text/plain', `logs-${new Date().toISOString()}}.txt`);
downloadString(all.join('\n'), 'text/plain', `logs-${new Date().toISOString()}.txt`);
}
}
13 changes: 10 additions & 3 deletions src/utils/errorlogger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
// import { getVersionInfo } from './VERSION';
import { getVersionInfo } from './VERSION';
import { setLogItem } from './debugdb';

/**
* Log a warning to both the browser console and the IndexedDB debug log.
* The debug log can be downloaded via the debug panel, making these warnings
* available in crash reports even when the DevTools console is not open.
*/
export function logWarning(str: string, ...arg: unknown[]): void {
console.warn(str, ...arg);
// console.log('Version information: ', getVersionInfo());
const detail = arg.length > 0 ? ` — ${JSON.stringify(arg)}` : '';
setLogItem(`WARN ${str}${detail}`);
console.warn(`[${getVersionInfo().env}] ${str}`, ...arg);
}