Skip to content

Commit 5e5514f

Browse files
committed
Refactor plugin loading logic: streamline logging for Simple Time Tracker and DataView plugins, adding verbose option for improved debugging.
1 parent d4a3556 commit 5e5514f

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

src/main.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,23 @@ export default class TimeTreePlugin extends Plugin {
2121
private commandHandler: TimeTreeHandler;
2222
private pluginLoadTime = 0;
2323

24-
private async loadPlugins(): Promise<void> {
25-
// List all loaded plugins in the console
26-
console.log("Loaded plugins:", Object.keys((this.app as AppWithPlugins).plugins.plugins));
27-
24+
private async loadPlugins(verbose = false): Promise<void> {
2825
// Load Simple Time Tracker API
2926
const simpleTimeTrackerPlugin = (this.app as AppWithPlugins).plugins.plugins["simple-time-tracker"];
3027
if (simpleTimeTrackerPlugin && simpleTimeTrackerPlugin.api) {
3128
this.simpleTimeTrackerApi = simpleTimeTrackerPlugin.api;
32-
console.log("Simple Time Tracker plugin loaded successfully.");
29+
if (verbose) console.log("Simple Time Tracker plugin loaded successfully.");
3330
} else {
34-
console.error("Simple Time Tracker plugin is not available.");
31+
if (verbose) console.error("Simple Time Tracker plugin is not available.");
3532
}
3633

3734
// Load DataView API
3835
const dataViewPlugin = (this.app as AppWithPlugins).plugins.plugins["dataview"];
3936
if (dataViewPlugin && dataViewPlugin.api) {
4037
this.dataViewApi = dataViewPlugin.api;
41-
console.log("DataView plugin loaded successfully.");
42-
} else {
43-
console.error("DataView plugin is not available.");
44-
}
45-
46-
// Check if Database Folder plugin is loaded
47-
const dbFolderPlugin = (this.app as AppWithPlugins).plugins.plugins["dbfolder"];
48-
if (dbFolderPlugin) {
49-
console.log("Database Folder plugin object:", dbFolderPlugin);
50-
if (dbFolderPlugin.api) {
51-
console.log("Database Folder plugin API is available:", dbFolderPlugin.api);
52-
} else {
53-
console.error("Database Folder plugin does not expose an API.");
54-
}
38+
if (verbose) console.log("DataView plugin loaded successfully.");
5539
} else {
56-
console.error("Database Folder plugin is not loaded.");
40+
if (verbose) console.error("DataView plugin is not available.");
5741
}
5842
}
5943

0 commit comments

Comments
 (0)