Pipe winston logs to dashboard + add Matrix sniff debug route

The dashboard's /api/logs buffer only ever saw lines explicitly pushed
via broadcaster.push, so winston output (including the Matrix
token-extractor's timeout diagnostics) was invisible from the deployed
container. Attach a winston transport that forwards every entry into the
LogBroadcaster before the rest of bootstrap runs, so the matrix sniff's
`finalUrl=... hosts=[...]` line shows up in /api/logs.

Also serve data/matrix-debug.png (the screenshot the extractor drops on
timeout) at /api/debug/matrix-debug.png so we can see what
chat.reddit.com looked like in the headed browser without shell access
to the Dokploy host.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
jjbruntonandClaude Opus 4.7 committed 2026-05-22 21:57:33 +01:00
1 parent 705d88dca1
commit 2bf8989ec7
4 files changed
+74 -2

No files matched your search

+10 -1
View File
@@ -1,5 +1,6 @@
import type { Config } from './config/index.js';
import type { Logger } from './utils/logger.js';
import { attachLogSink, type Logger } from './utils/logger.js';
import { LogBroadcaster } from './web/log-broadcaster.js';
import type Database from 'better-sqlite3';
import { createDatabase, runMigrations } from './database/client.js';
import {
@@ -73,6 +74,13 @@ export interface AppContainer {
* shutdown).
*/
export async function bootstrap(config: Config, logger: Logger): Promise<AppContainer> {
// Wire winston → dashboard log buffer immediately so the matrix-token
// sniff and other early bootstrap diagnostics are visible in /api/logs.
const broadcaster = new LogBroadcaster();
if (config.web.enabled) {
attachLogSink(logger, broadcaster);
}
// Database
const db = createDatabase(config);
runMigrations(db);
@@ -258,6 +266,7 @@ export async function bootstrap(config: Config, logger: Logger): Promise<AppCont
successfulMessagesRepo,
activityLogRepo,
logger,
broadcaster,
);
webServer.setChatService(chatService);