Rename
This commit is contained in:
parent
396d07be66
commit
b56e8f6c15
2 changed files with 3 additions and 3 deletions
23
frontend/obsidian-plugin/src/utils/log-to-console.ts
Normal file
23
frontend/obsidian-plugin/src/utils/log-to-console.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import type { LogLine, SyncClient } from "sync-client";
|
||||||
|
import { LogLevel } from "sync-client";
|
||||||
|
|
||||||
|
export function logToConsole(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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,7 @@ import { StatusDescription } from "./views/status-description/status-description
|
||||||
import { SyncClient, rateLimit, DEFAULT_SETTINGS } from "sync-client";
|
import { SyncClient, rateLimit, DEFAULT_SETTINGS } from "sync-client";
|
||||||
import { ObsidianFileSystemOperations } from "./obsidian-file-system";
|
import { ObsidianFileSystemOperations } from "./obsidian-file-system";
|
||||||
import { SyncSettingsTab } from "./views/settings/settings-tab";
|
import { SyncSettingsTab } from "./views/settings/settings-tab";
|
||||||
import { registerConsoleForLogging } from "./utils/register-console-for-logging";
|
import { logToConsole } from "./utils/log-to-console";
|
||||||
import { updateEditorStatusDisplay } from "./views/editor-sync-line/editor-sync-line";
|
import { updateEditorStatusDisplay } from "./views/editor-sync-line/editor-sync-line";
|
||||||
import { remoteCursorsTheme } from "./views/cursors/remote-cursor-theme";
|
import { remoteCursorsTheme } from "./views/cursors/remote-cursor-theme";
|
||||||
import {
|
import {
|
||||||
|
|
@ -53,7 +53,7 @@ export default class VaultLinkPlugin extends Plugin {
|
||||||
nativeLineEndings: Platform.isWin ? "\r\n" : "\n"
|
nativeLineEndings: Platform.isWin ? "\r\n" : "\n"
|
||||||
});
|
});
|
||||||
|
|
||||||
registerConsoleForLogging(this.client);
|
logToConsole(this.client);
|
||||||
|
|
||||||
const statusDescription = new StatusDescription(this.client);
|
const statusDescription = new StatusDescription(this.client);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue