Browse Source

chore(logging): turn off logToDB since it was blowing up and hiding real errors in noise.

sql-absurd-sql-further
Matthew Raymer 5 days ago
parent
commit
596f3355bf
  1. 14
      src/db/databaseUtil.ts

14
src/db/databaseUtil.ts

@ -137,10 +137,10 @@ export async function logToDb(message: string): Promise<void> {
try { try {
// Try to insert first, if it fails due to UNIQUE constraint, update instead // Try to insert first, if it fails due to UNIQUE constraint, update instead
await platform.dbExec("INSERT INTO logs (date, message) VALUES (?, ?)", [ // await platform.dbExec("INSERT INTO logs (date, message) VALUES (?, ?)", [
nowKey, // nowKey,
message, // message,
]); // ]);
// Clean up old logs (keep only last 7 days) - do this less frequently // Clean up old logs (keep only last 7 days) - do this less frequently
// Only clean up if the date is different from the last cleanup // Only clean up if the date is different from the last cleanup
@ -148,9 +148,9 @@ export async function logToDb(message: string): Promise<void> {
const sevenDaysAgo = new Date( const sevenDaysAgo = new Date(
new Date().getTime() - 7 * 24 * 60 * 60 * 1000, new Date().getTime() - 7 * 24 * 60 * 60 * 1000,
); );
await platform.dbExec("DELETE FROM logs WHERE date < ?", [ // await platform.dbExec("DELETE FROM logs WHERE date < ?", [
sevenDaysAgo.toDateString(), // sevenDaysAgo.toDateString(),
]); // ]);
lastCleanupDate = todayKey; lastCleanupDate = todayKey;
} }
} catch (error) { } catch (error) {

Loading…
Cancel
Save