Skip to content

Commit 3497d08

Browse files
committed
✨ Add JSON log file output for menubar app
TDD daemon now writes JSON logs to .vizzly/server.log that the menubar app can read and display. Log format is NDJSON with timestamp, level, message, and contextual data. - Configure output.logFile in daemon child process - Register logFile path in server registry - Include logFile in server.json for local discovery
1 parent 54ce7ce commit 3497d08

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/commands/tdd-daemon.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,15 @@ export async function tddStartCommand(options = {}, globalOptions = {}) {
203203
// Clean up any stale servers first
204204
registry.cleanupStale();
205205

206-
// Register this server
206+
// Register this server with log file path for menubar to read
207+
let serverLogFile = join(process.cwd(), '.vizzly', 'server.log');
207208
registry.register({
208209
pid: child.pid,
209210
port: port,
210211
directory: process.cwd(),
211212
name: basename(process.cwd()),
212213
startedAt: new Date().toISOString(),
214+
logFile: serverLogFile,
213215
});
214216
} catch {
215217
// Non-fatal
@@ -284,6 +286,17 @@ export async function runDaemonChild(options = {}, globalOptions = {}) {
284286
const vizzlyDir = join(process.cwd(), '.vizzly');
285287
const port = options.port || 47392;
286288

289+
// Set up log file for menubar app to read
290+
const logFile = join(vizzlyDir, 'server.log');
291+
292+
// Configure output to write JSON logs to file (before tddCommand configures it)
293+
output.configure({
294+
logFile,
295+
json: globalOptions.json,
296+
verbose: globalOptions.verbose,
297+
color: !globalOptions.noColor,
298+
});
299+
287300
try {
288301
// Use existing tddCommand but with daemon mode
289302
const { cleanup } = await tddCommand(
@@ -309,6 +322,7 @@ export async function runDaemonChild(options = {}, globalOptions = {}) {
309322
port: port,
310323
startTime: Date.now(),
311324
failOnDiff: options.failOnDiff || false,
325+
logFile: logFile,
312326
};
313327
writeFileSync(
314328
join(vizzlyDir, 'server.json'),

0 commit comments

Comments
 (0)