mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-05 15:58:19 +00:00
Route Journal recovery notices through the existing logger
This commit is contained in:
1 parent
9e564eb51e
commit
a0f1483891
2 files changed
+24
-15
No files matched your search
@@ -1,6 +1,5 @@
|
|||||||
import { EVENT_REQUEST_PERFORM_GC_V3, eventHub } from "@/common/events.ts";
|
import { EVENT_REQUEST_PERFORM_GC_V3, eventHub } from "@/common/events.ts";
|
||||||
import { $msg } from "@/common/translation";
|
import { $msg } from "@/common/translation";
|
||||||
import { Notice } from "@/deps.ts";
|
|
||||||
import {
|
import {
|
||||||
createCoreSettingsAfterFullReset,
|
createCoreSettingsAfterFullReset,
|
||||||
createEditingSettingsAfterFullReset,
|
createEditingSettingsAfterFullReset,
|
||||||
@@ -171,19 +170,21 @@ export function paneMaintenance(
|
|||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
const replicator = this.core.replicator;
|
const replicator = this.core.replicator;
|
||||||
if (!isLiveSyncJournalReplicator(replicator)) {
|
if (!isLiveSyncJournalReplicator(replicator)) {
|
||||||
new Notice(
|
Logger(
|
||||||
$msg(
|
$msg(
|
||||||
"No stopped Journal is available. Retry replication to identify the stopped Journal."
|
"No stopped Journal is available. Retry replication to identify the stopped Journal."
|
||||||
)
|
),
|
||||||
|
LOG_LEVEL_NOTICE
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const stoppedJournal: Readonly<StoppedJournal> | undefined = replicator.getStoppedJournal();
|
const stoppedJournal: Readonly<StoppedJournal> | undefined = replicator.getStoppedJournal();
|
||||||
if (!stoppedJournal) {
|
if (!stoppedJournal) {
|
||||||
new Notice(
|
Logger(
|
||||||
$msg(
|
$msg(
|
||||||
"No stopped Journal is available. Retry replication to identify the stopped Journal."
|
"No stopped Journal is available. Retry replication to identify the stopped Journal."
|
||||||
)
|
),
|
||||||
|
LOG_LEVEL_NOTICE
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -202,10 +203,11 @@ export function paneMaintenance(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.core.replicator !== replicator) {
|
if (this.core.replicator !== replicator) {
|
||||||
new Notice(
|
Logger(
|
||||||
$msg(
|
$msg(
|
||||||
"The active replicator changed. Retry replication to identify the stopped Journal."
|
"The active replicator changed. Retry replication to identify the stopped Journal."
|
||||||
)
|
),
|
||||||
|
LOG_LEVEL_NOTICE
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -214,10 +216,11 @@ export function paneMaintenance(
|
|||||||
stoppedJournal
|
stoppedJournal
|
||||||
);
|
);
|
||||||
if (!resumed) {
|
if (!resumed) {
|
||||||
new Notice(
|
Logger(
|
||||||
$msg(
|
$msg(
|
||||||
"Journal receipt did not complete after this action. Check the current failure before retrying."
|
"Journal receipt did not complete after this action. Check the current failure before retrying."
|
||||||
)
|
),
|
||||||
|
LOG_LEVEL_NOTICE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -326,9 +326,11 @@ describe("paneMaintenance", () => {
|
|||||||
expect(getStoppedJournal).toHaveBeenCalledOnce();
|
expect(getStoppedJournal).toHaveBeenCalledOnce();
|
||||||
expect(rendered.askYesNoDialog).not.toHaveBeenCalled();
|
expect(rendered.askYesNoDialog).not.toHaveBeenCalled();
|
||||||
expect(skipStoppedJournalAndResume).not.toHaveBeenCalled();
|
expect(skipStoppedJournalAndResume).not.toHaveBeenCalled();
|
||||||
expect(maintenanceHarness.notice).toHaveBeenCalledWith(
|
expect(maintenanceHarness.logger).toHaveBeenCalledWith(
|
||||||
"No stopped Journal is available. Retry replication to identify the stopped Journal."
|
"No stopped Journal is available. Retry replication to identify the stopped Journal.",
|
||||||
|
"notice"
|
||||||
);
|
);
|
||||||
|
expect(maintenanceHarness.notice).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not skip the stopped Journal when confirmation is cancelled", async () => {
|
it("does not skip the stopped Journal when confirmation is cancelled", async () => {
|
||||||
@@ -378,9 +380,11 @@ describe("paneMaintenance", () => {
|
|||||||
|
|
||||||
expect(active.skipStoppedJournalAndResume).not.toHaveBeenCalled();
|
expect(active.skipStoppedJournalAndResume).not.toHaveBeenCalled();
|
||||||
expect(replacement.skipStoppedJournalAndResume).not.toHaveBeenCalled();
|
expect(replacement.skipStoppedJournalAndResume).not.toHaveBeenCalled();
|
||||||
expect(maintenanceHarness.notice).toHaveBeenCalledWith(
|
expect(maintenanceHarness.logger).toHaveBeenCalledWith(
|
||||||
"The active replicator changed. Retry replication to identify the stopped Journal."
|
"The active replicator changed. Retry replication to identify the stopped Journal.",
|
||||||
|
"notice"
|
||||||
);
|
);
|
||||||
|
expect(maintenanceHarness.notice).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reports when receipt does not complete after skip and resume", async () => {
|
it("reports when receipt does not complete after skip and resume", async () => {
|
||||||
@@ -391,8 +395,10 @@ describe("paneMaintenance", () => {
|
|||||||
await rendered.click();
|
await rendered.click();
|
||||||
|
|
||||||
expect(skipStoppedJournalAndResume).toHaveBeenCalledOnce();
|
expect(skipStoppedJournalAndResume).toHaveBeenCalledOnce();
|
||||||
expect(maintenanceHarness.notice).toHaveBeenCalledWith(
|
expect(maintenanceHarness.logger).toHaveBeenCalledWith(
|
||||||
"Journal receipt did not complete after this action. Check the current failure before retrying."
|
"Journal receipt did not complete after this action. Check the current failure before retrying.",
|
||||||
|
"notice"
|
||||||
);
|
);
|
||||||
|
expect(maintenanceHarness.notice).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user