forked from trent_larson/crowd-funder-for-time-pwa
fix more logging cleanup errors
This commit is contained in:
@@ -145,8 +145,7 @@ export async function logToDb(message: string): Promise<void> {
|
|||||||
// 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
|
||||||
if (!lastCleanupDate || lastCleanupDate !== todayKey) {
|
if (!lastCleanupDate || lastCleanupDate !== todayKey) {
|
||||||
const sevenDaysAgo = new Date();
|
const sevenDaysAgo = new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000);
|
||||||
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
|
|
||||||
await platform.dbExec("DELETE FROM logs WHERE date < ?", [
|
await platform.dbExec("DELETE FROM logs WHERE date < ?", [
|
||||||
sevenDaysAgo.toDateString(),
|
sevenDaysAgo.toDateString(),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const logger = {
|
|||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.debug(message, ...args);
|
console.debug(message, ...args);
|
||||||
const argsString = args.length > 0 ? " - " + safeStringify(args) : "";
|
const argsString = args.length > 0 ? " - " + safeStringify(args) : "";
|
||||||
logToDb(message + argsString);
|
// logToDb(message + argsString);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
log: (message: string, ...args: unknown[]) => {
|
log: (message: string, ...args: unknown[]) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user