This commit is contained in:
Andras Schmelczer 2025-08-10 12:59:14 +01:00
parent 396d07be66
commit b56e8f6c15
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 3 additions and 3 deletions

View file

@ -1,23 +0,0 @@
import type { LogLine, SyncClient } from "sync-client";
import { LogLevel } from "sync-client";
export function registerConsoleForLogging(client: SyncClient): void {
client.logger.addOnMessageListener((logLine: LogLine) => {
const formatted = `${logLine.timestamp.toISOString()} ${logLine.level} ${logLine.message}`;
switch (logLine.level) {
case LogLevel.ERROR:
console.error(formatted);
break;
case LogLevel.WARNING:
console.warn(formatted);
break;
case LogLevel.INFO:
console.info(formatted);
break;
case LogLevel.DEBUG:
console.debug(formatted);
break;
}
});
}