forked from jsnbuchanan/crowd-funder-for-time-pwa
fix more of the logging & log display
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user