fix more of the logging & log display

This commit is contained in:
2025-05-28 20:08:09 -06:00
parent c637d39dc9
commit 01c33069c4
2 changed files with 14 additions and 13 deletions

View File

@@ -133,13 +133,13 @@ let lastCleanupDate: string | null = null;
export async function logToDb(message: string): Promise<void> {
const platform = PlatformServiceFactory.getInstance();
const todayKey = new Date().toDateString();
const fullMessage = `${new Date().toISOString()} ${message}`;
const nowKey = new Date().toISOString();
try {
// Try to insert first, if it fails due to UNIQUE constraint, update instead
await platform.dbExec("INSERT INTO logs (date, message) VALUES (?, ?)", [
todayKey,
fullMessage,
nowKey,
message,
]);
// Clean up old logs (keep only last 7 days) - do this less frequently