fix(logs): the browser's copy of a polled read is quiet too
The server now logs polled reads at DEBUG, and the browser's copy of each request line promises the server's level: at INFO the unread-count polls filled My log within minutes and, at Detailed, the shipped log. The server marks a line it logged at DEBUG with X-Log-Quiet, so the polled-route list stays in one place.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { pathTemplate, send } from "./http";
|
||||
import { clear, events } from "./log";
|
||||
import { clear, events, setLevel } from "./log";
|
||||
|
||||
afterEach(() => {
|
||||
setLevel("INFO");
|
||||
clear();
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
@@ -41,6 +42,18 @@ describe("send", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
// The server logs the reads the app polls at DEBUG and says so (`X-Log-Quiet`); at INFO the
|
||||
// browser's copies filled My log with unread-count polls within minutes (prod UAT 2026-09-19).
|
||||
it("logs a read the server called quiet at DEBUG, so the base level keeps it out", async () => {
|
||||
vi.stubGlobal("fetch", async () => answer(200, { "X-Log-Quiet": "1" }));
|
||||
await send("/api/messages/unread_count");
|
||||
expect(events()).toEqual([]);
|
||||
|
||||
setLevel("DEBUG");
|
||||
await send("/api/messages/unread_count");
|
||||
expect(events().map((e) => e.level)).toEqual(["DEBUG"]);
|
||||
});
|
||||
|
||||
it("logs a network failure without the concrete path, and still rejects", async () => {
|
||||
vi.stubGlobal("fetch", async () => {
|
||||
throw new TypeError("Failed to fetch");
|
||||
|
||||
Reference in New Issue
Block a user