Actually, using time stamps as an id prefix is probably a better idea

This commit is contained in:
Martin Kleinschrodt 2022-07-29 18:06:33 +02:00
parent 3736fac4c5
commit e2d8dc21ce
1 changed files with 1 additions and 2 deletions

View File

@ -1,5 +1,4 @@
import { Logger, LogEvent } from "@padloc/core/src/logging";
import { unsafeUUID } from "@padloc/core/src/util";
import { PostgresStorage } from "../storage/postgres";
export class PostgresLogger implements Logger {
@ -7,7 +6,7 @@ export class PostgresLogger implements Logger {
log(type: string, data?: any) {
const event = new LogEvent(type, data);
event.id = unsafeUUID();
event.id = `${event.time.toISOString()}_${Math.floor(Math.random() * 1e6)}`;
(async () => {
try {
this._storage.save(event);