Remove minimum log level

This commit is contained in:
Andras Schmelczer 2025-03-20 20:59:49 +00:00
parent b00b9521c6
commit e6563c99b0
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
3 changed files with 2 additions and 40 deletions

View file

@ -1,7 +1,7 @@
import type { WorkspaceLeaf } from "obsidian"; import type { WorkspaceLeaf } from "obsidian";
import { ItemView } from "obsidian"; import { ItemView } from "obsidian";
import type VaultLinkPlugin from "../vault-link-plugin"; import type VaultLinkPlugin from "../vault-link-plugin";
import type { SyncClient } from "sync-client"; import { LogLevel, type SyncClient } from "sync-client";
export class LogsView extends ItemView { export class LogsView extends ItemView {
public static readonly TYPE = "logs-view"; public static readonly TYPE = "logs-view";
@ -17,12 +17,6 @@ export class LogsView extends ItemView {
this.client.logger.addOnMessageListener(() => { this.client.logger.addOnMessageListener(() => {
this.updateView(); this.updateView();
}); });
this.client.addOnSettingsChangeHandlers((newSettings, oldSettings) => {
if (newSettings.minimumLogLevel !== oldSettings.minimumLogLevel) {
this.updateView();
}
});
} }
private static formatTimestamp(timestamp: Date): string { private static formatTimestamp(timestamp: Date): string {
@ -77,9 +71,7 @@ export class LogsView extends ItemView {
} }
); );
const logs = this.client.logger.getMessages( const logs = this.client.logger.getMessages(LogLevel.DEBUG);
this.client.getSettings().minimumLogLevel
);
if (logs.length === 0) { if (logs.length === 0) {
container.createEl("p", { text: "No logs available yet." }); container.createEl("p", { text: "No logs available yet." });

View file

@ -51,7 +51,6 @@ export class SyncSettingsTab extends PluginSettingTab {
this.renderSettingsHeader(containerEl); this.renderSettingsHeader(containerEl);
this.renderConnectionSettings(containerEl); this.renderConnectionSettings(containerEl);
this.renderSyncSettings(containerEl); this.renderSyncSettings(containerEl);
this.renderViewSettings(containerEl);
} }
public hide(): void { public hide(): void {
@ -272,33 +271,6 @@ export class SyncSettingsTab extends PluginSettingTab {
); );
} }
private renderViewSettings(containerEl: HTMLElement): void {
containerEl.createEl("h3", { text: "View" });
new Setting(containerEl)
.setName("Minimum log level")
.setDesc(
"Set the log level for the plugin. Lower levels will show more logs."
)
.addDropdown((dropdown) =>
dropdown
.addOptions({
[LogLevel.DEBUG]: LogLevel.DEBUG,
[LogLevel.INFO]: LogLevel.INFO,
[LogLevel.WARNING]: LogLevel.WARNING,
[LogLevel.ERROR]: LogLevel.ERROR
})
.setValue(this.syncClient.getSettings().minimumLogLevel)
.onChange(async (value) =>
this.syncClient.setSetting(
"minimumLogLevel",
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
value as LogLevel
)
)
);
}
private setStatusDescriptionSubscription( private setStatusDescriptionSubscription(
newSubscription?: () => void newSubscription?: () => void
): void { ): void {

View file

@ -8,7 +8,6 @@ export interface SyncSettings {
fetchChangesUpdateIntervalMs: number; fetchChangesUpdateIntervalMs: number;
syncConcurrency: number; syncConcurrency: number;
isSyncEnabled: boolean; isSyncEnabled: boolean;
minimumLogLevel: LogLevel;
maxFileSizeMB: number; maxFileSizeMB: number;
} }
@ -19,7 +18,6 @@ const DEFAULT_SETTINGS: SyncSettings = {
fetchChangesUpdateIntervalMs: 1000, fetchChangesUpdateIntervalMs: 1000,
syncConcurrency: 1, syncConcurrency: 1,
isSyncEnabled: false, isSyncEnabled: false,
minimumLogLevel: LogLevel.INFO,
maxFileSizeMB: 10 maxFileSizeMB: 10
}; };