Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat: improve session log
Gus05898afdc755
diff --git a/src/cli/daemon/config.test.ts b/src/cli/daemon/config.test.tsindex 36765a7a2..eafed180c 100644--- a/src/cli/daemon/config.test.ts+++ b/src/cli/daemon/config.test.ts@@ -35,7 +35,7 @@ describe("loadDaemonConfig defaults", () => {expect(cfg.serverURL).toBe("https://alook.ai");expect(cfg.pollInterval).toBe(3000);- expect(cfg.agentTimeout).toBe(7200000);+ expect(cfg.agentTimeout).toBe(43200000);expect(cfg.maxConcurrentTasks).toBe(20);expect(cfg.claudePath).toBe("claude");expect(cfg.runtimeName).toBe("Local Agent");diff --git a/src/cli/daemon/config.ts b/src/cli/daemon/config.tsindex fc0ca5ece..949c5bb20 100644--- a/src/cli/daemon/config.ts+++ b/src/cli/daemon/config.ts@@ -104,7 +104,7 @@ export function loadDaemonConfig(profile?: string): DaemonConfig {pollInterval: parseDuration(process.env.ALOOK_DAEMON_POLL_INTERVAL || "3s",),- agentTimeout: parseDuration(process.env.ALOOK_AGENT_TIMEOUT || "2h"),+ agentTimeout: parseDuration(process.env.ALOOK_AGENT_TIMEOUT || "12h"),maxConcurrentTasks: parseInt(process.env.ALOOK_DAEMON_MAX_CONCURRENT_TASKS || "20",),diff --git a/src/cli/daemon/daemon.test.ts b/src/cli/daemon/daemon.test.tsindex f2fe86c2e..de4ce33cb 100644--- a/src/cli/daemon/daemon.test.ts+++ b/src/cli/daemon/daemon.test.ts@@ -889,7 +889,7 @@ describe("spawnSessionRunner", () => {expect(child.unref).toHaveBeenCalled();});- it("opens a log file fd and passes it as stdio [ignore, fd, fd]", () => {+ it("opens a log file fd with taskId.log and passes it as stdio [ignore, fd, fd]", () => {spawnSessionRunner(makeSpawnInput() as any);expect(mockMkdirSync).toHaveBeenCalledWith(@@ -910,13 +910,14 @@ describe("spawnSessionRunner", () => {expect(mockCloseSync).toHaveBeenCalledWith(42);});- it("renames the temp log file to PID.log after spawn", () => {- spawnSessionRunner(makeSpawnInput() as any);+ it("sets logFilePath in the serialized input", () => {+ const input = makeSpawnInput() as any;+ spawnSessionRunner(input);- expect(mockRenameSync).toHaveBeenCalledWith(- "/tmp/alook/daemon/session-runners/t1.log",- "/tmp/alook/daemon/session-runners/50000.log",- );+ const call = vi.mocked(spawn).mock.calls[0];+ const encoded = call[1]![1] as string;+ const decoded = JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));+ expect(decoded.logFilePath).toBe("/tmp/alook/daemon/session-runners/t1.log");});});diff --git a/src/cli/daemon/daemon.ts b/src/cli/daemon/daemon.tsindex 9623f4ec5..479980b76 100644--- a/src/cli/daemon/daemon.ts+++ b/src/cli/daemon/daemon.ts@@ -8,7 +8,7 @@ import { log } from "../lib/logger.js";import { cmdPrefix } from "../lib/env.js";import { acquireDaemonPid, releaseDaemonPid } from "./pidfile.js";import { handleCliUpdate, isUpdating, readUpdateMarker, clearUpdateMarker } from "./update-handler.js";-import { existsSync, mkdirSync, openSync, closeSync, renameSync, readdirSync, statSync, unlinkSync } from "fs";+import { existsSync, mkdirSync, openSync, closeSync, readdirSync, statSync, unlinkSync } from "fs";import { execSync, spawn, type ChildProcess } from "child_process";import { fileURLToPath } from "url";import { dirname, join } from "path";@@ -382,12 +382,14 @@ export async function startDaemon(}export function spawnSessionRunner(input: SessionRunnerInput): ChildProcess {- const encoded = Buffer.from(JSON.stringify(input)).toString("base64");-const logDir = sessionRunnerLogDir();mkdirSync(logDir, { recursive: true });- const tmpLogPath = join(logDir, `${input.task.id}.log`);- const fd = openSync(tmpLogPath, "a");++ const logFilePath = join(logDir, `${input.task.id}.log`);+ input.logFilePath = logFilePath;++ const encoded = Buffer.from(JSON.stringify(input)).toString("base64");+ const fd = openSync(logFilePath, "a");const child = spawn(process.execPath, [sessionRunnerPath, encoded], {detached: true,@@ -396,11 +398,6 @@ export function spawnSessionRunner(input: SessionRunnerInput): ChildProcess {child.unref();closeSync(fd);- if (child.pid) {- const pidLogPath = join(logDir, `${child.pid}.log`);- renameSync(tmpLogPath, pidLogPath);- }-return child;}diff --git a/src/cli/daemon/execenv/__tests__/index.test.ts b/src/cli/daemon/execenv/__tests__/index.test.tsindex 30c1a0c92..179b6dd6c 100644--- a/src/cli/daemon/execenv/__tests__/index.test.ts+++ b/src/cli/daemon/execenv/__tests__/index.test.ts@@ -79,13 +79,6 @@ describe("prepare", () => {expect(mtime2).toBe(mtime1);});- it("returns logFile path at {root}/{wsId}/{agentId}/agent.log", () => {- const task = makeTask();- const result = prepare({ workspacesRoot: root }, task);-- expect(result.logFile).toBe(join(root, "ws1", "a1", "agent.log"));- });-it("creates .context_timeline/ directory inside workdir", () => {const task = makeTask();const result = prepare({ workspacesRoot: root }, task);diff --git a/src/cli/daemon/execenv/index.ts b/src/cli/daemon/execenv/index.tsindex d555f754f..f723da945 100644--- a/src/cli/daemon/execenv/index.ts+++ b/src/cli/daemon/execenv/index.ts@@ -1,5 +1,5 @@import { mkdirSync } from "fs";-import { join, dirname } from "path";+import { join } from "path";import { writeInstructionFileIfChanged } from "./context.js";import type { Task } from "../types.js";@@ -9,7 +9,6 @@ export interface ExecEnvConfig {export interface ExecEnvResult {workDir: string;- logFile: string;timelineDir: string;env: Record<string, string>;}@@ -27,14 +26,6 @@ export function prepare(writeInstructionFileIfChanged(workDir, task);- const logFile = join(- config.workspacesRoot,- task.workspaceId,- task.agentId,- "agent.log",- );- mkdirSync(dirname(logFile), { recursive: true });-const env: Record<string, string> = {ALOOK_WORKSPACE_ID: task.workspaceId,ALOOK_AGENT_ID: task.agentId,@@ -43,7 +34,7 @@ export function prepare(ALOOK_HEALTH_PORT: process.env.ALOOK_HEALTH_PORT || "19514",};- return { workDir, logFile, timelineDir, env };+ return { workDir, timelineDir, env };}export { buildInstructionContent, writeInstructionFileIfChanged, ensureSymlinks, CANONICAL_FILE } from "./context.js";diff --git a/src/cli/daemon/execenv/timeline.ts b/src/cli/daemon/execenv/timeline.tsindex e29bfbbea..dbe812deb 100644--- a/src/cli/daemon/execenv/timeline.ts+++ b/src/cli/daemon/execenv/timeline.ts@@ -32,6 +32,7 @@ export interface ContextTimelineEntry {agent_responses: string[];errmsg: string | null;provider: string | null;+ detailed_log: string | null;}function filenameForDate(date: Date): string {@@ -197,6 +198,7 @@ export function createTimelineEntry(pid?: number,provider?: string,contextKey?: string | null,+ detailedLog?: string | null,): ContextTimelineEntry {return {task_id: taskId,@@ -210,6 +212,7 @@ export function createTimelineEntry(agent_responses: [],errmsg: null,provider: provider ?? null,+ detailed_log: detailedLog ?? null,};}diff --git a/src/cli/daemon/session-runner.test.ts b/src/cli/daemon/session-runner.test.tsindex d8fc4e67a..2a70ef333 100644--- a/src/cli/daemon/session-runner.test.ts+++ b/src/cli/daemon/session-runner.test.ts@@ -14,7 +14,6 @@ vi.mock("./client.js", () => {const mockPrepare = vi.fn(() => ({workDir: "/tmp/ws/ws1/agent1/workdir",- logFile: "/tmp/ws/ws1/agent1/agent.log",timelineDir: "/tmp/ws/ws1/agent1/workdir/.context_timeline",env: {ALOOK_WORKSPACE_ID: "ws1",@@ -39,6 +38,7 @@ const mockCreateTimelineEntry = vi.fn(pid?: number,provider?: string,contextKey?: string | null,+ detailedLog?: string | null,) => ({task_id: taskId,context_key: contextKey ?? null,@@ -51,6 +51,7 @@ const mockCreateTimelineEntry = vi.fn(agent_responses: [],errmsg: null,provider: provider || null,+ detailed_log: detailedLog ?? null,}),);const mockFindResumableSessionByContextKey = vi.fn(() => null);@@ -59,7 +60,6 @@ vi.mock("./execenv/timeline.js", () => ({updateEntry: (...args: any[]) => mockUpdateEntry(...args),createTimelineEntry: (...args: any[]) => mockCreateTimelineEntry(...args),findResumableSessionByContextKey: (...args: any[]) => mockFindResumableSessionByContextKey(...args),- localISOString: () => "2026-04-16T10:00:00-05:00",}));vi.mock("./prompt.js", () => ({@@ -74,16 +74,14 @@ vi.mock("./agent/index.js", () => ({})),}));-vi.mock("fs", () => ({- createWriteStream: vi.fn(() => ({- write: vi.fn(),- end: vi.fn(),- })),+vi.mock("../lib/logger.js", () => ({+ log: { info: vi.fn(), error: vi.fn(), debug: vi.fn(), warn: vi.fn() },}));import { runSession } from "./session-runner.js";import { createBackend } from "./agent/index.js";import { buildPrompt } from "./prompt.js";+import { log as mockLog } from "../lib/logger.js";import type { SessionRunnerInput } from "./types.js";function makeInput(overrides?: Partial<SessionRunnerInput>): SessionRunnerInput {@@ -218,6 +216,7 @@ describe("session-runner runSession", () => {process.pid,"claude","dm:c1",+ undefined,);expect(mockInitEntryAsync).toHaveBeenCalledWith("/tmp/ws/ws1/agent1/workdir/.context_timeline",@@ -532,37 +531,6 @@ describe("session-runner runSession", () => {expect(process.listenerCount("SIGTERM")).toBe(listenersBefore);});- it("writes agent.log JSONL", async () => {- const { createWriteStream } = await import("fs");- const mockWrite = vi.fn();- vi.mocked(createWriteStream).mockReturnValue({- write: mockWrite,- end: vi.fn(),- } as any);-- setupBackend(- [{ type: "text", content: "hello" }],- {- status: "completed",- output: "Done",- error: "",- durationMs: 100,- sessionId: "sess-1",- },- );-- await runSession(makeInput());-- // First write = user prompt, second write = assistant message- expect(mockWrite).toHaveBeenCalledTimes(2);- const firstLine = JSON.parse(mockWrite.mock.calls[0][0].replace("\n", ""));- expect(firstLine.role).toBe("user");- expect(firstLine.content).toBe("do the thing");- const secondLine = JSON.parse(mockWrite.mock.calls[1][0].replace("\n", ""));- expect(secondLine.role).toBe("assistant");- expect(secondLine.type).toBe("text");- });-it("passes provider to createTimelineEntry", async () => {setupBackend([], {status: "completed",@@ -582,6 +550,7 @@ describe("session-runner runSession", () => {process.pid,"codex","dm:c1",+ undefined,);});@@ -645,4 +614,197 @@ describe("session-runner runSession", () => {expect.objectContaining({ resumeSessionId: undefined }),);});++ // --- Logging tests ---++ describe("logging", () => {+ it("logs task start with metadata", async () => {+ setupBackend([], {+ status: "completed",+ output: "Done",+ error: "",+ durationMs: 1000,+ sessionId: "sess-1",+ });++ await runSession(makeInput());++ expect(mockLog.info).toHaveBeenCalledWith(+ "starting (task=t1, type=user_dm_message, agent=a1, provider=claude, model=opus)",+ );+ });++ it("logs agent started with PID and session ID", async () => {+ setupBackend([], {+ status: "completed",+ output: "Done",+ error: "",+ durationMs: 1000,+ sessionId: "sess-1",+ });++ await runSession(makeInput());++ expect(mockLog.info).toHaveBeenCalledWith(+ "agent started (pid=12345, session=sess-1)",+ );+ });++ it("logs user prompt with role=user", async () => {+ setupBackend([], {+ status: "completed",+ output: "Done",+ error: "",+ durationMs: 1000,+ sessionId: "sess-1",+ });++ await runSession(makeInput());++ expect(mockLog.info).toHaveBeenCalledWith(+ JSON.stringify({ role: "user", type: "text", content: "do the thing" }),+ );+ });++ it("logs each agent message with role=assistant", async () => {+ const msg = { type: "text", content: "hello world" };+ setupBackend(+ [msg],+ {+ status: "completed",+ output: "Done",+ error: "",+ durationMs: 1000,+ sessionId: "sess-1",+ },+ );++ await runSession(makeInput());++ expect(mockLog.info).toHaveBeenCalledWith(+ JSON.stringify({ role: "assistant", ...msg }),+ );+ });++ it("logs tool-use messages with role=assistant and counts tools", async () => {+ const messages = [+ { type: "tool-use", tool: "Read", callId: "c1", input: { file_path: "a.ts" } },+ { type: "tool-result", tool: "Read", callId: "c1", output: "ok" },+ { type: "tool-use", tool: "Edit", callId: "c2", input: { file_path: "a.ts" } },+ { type: "tool-result", tool: "Edit", callId: "c2", output: "ok" },+ ];+ setupBackend(messages, {+ status: "completed",+ output: "Done",+ error: "",+ durationMs: 5400,+ sessionId: "sess-1",+ });++ await runSession(makeInput());++ for (const msg of messages) {+ expect(mockLog.info).toHaveBeenCalledWith(+ JSON.stringify({ role: "assistant", ...msg }),+ );+ }+ expect(mockLog.info).toHaveBeenCalledWith(+ "completed (duration=5.4s, messages=4, tools=2)",+ );+ });++ it("logs completion with duration, message count, and tool count", async () => {+ setupBackend(+ [+ { type: "text", content: "thinking..." },+ { type: "tool-use", tool: "Read", callId: "c1", input: { file_path: "a.ts" } },+ { type: "tool-result", tool: "Read", callId: "c1", output: "ok" },+ ],+ {+ status: "completed",+ output: "Done",+ error: "",+ durationMs: 5400,+ sessionId: "sess-1",+ },+ );++ await runSession(makeInput());++ expect(mockLog.info).toHaveBeenCalledWith(+ "completed (duration=5.4s, messages=3, tools=1)",+ );+ });++ it("logs failure with duration, message count, tool count, and error", async () => {+ setupBackend(+ [+ { type: "tool-use", tool: "Bash", callId: "c1", input: { command: "exit 1" } },+ { type: "tool-result", tool: "Bash", callId: "c1", output: "err" },+ ],+ {+ status: "failed",+ output: "",+ error: "command failed",+ durationMs: 1200,+ sessionId: "sess-1",+ },+ );++ await runSession(makeInput());++ expect(mockLog.info).toHaveBeenCalledWith(+ "failed (duration=1.2s, messages=2, tools=1) — command failed",+ );+ });++ it("logs kill with message count and tool count", async () => {+ const killSpy = vi.spyOn(process, "kill").mockImplementation(() => true);+ const exitSpy = vi.spyOn(process, "exit").mockImplementation((() => {}) as any);++ let resolveMessage: (() => void) | null = null;++ mockBackendExecute.mockReturnValue({+ pid: 99999,+ messages: (async function* () {+ yield { type: "tool-use", tool: "Read", callId: "c1", input: { file_path: "x.ts" } };+ yield { type: "tool-result", tool: "Read", callId: "c1", output: "ok" };+ yield { type: "text", content: "working..." };+ await new Promise<void>((resolve) => { resolveMessage = resolve; });+ })(),+ sessionId: Promise.resolve("sess-kill"),+ result: new Promise(() => {}),+ });++ const sessionPromise = runSession(makeInput());+ await new Promise((r) => setTimeout(r, 50));++ process.emit("SIGTERM", "SIGTERM");+ if (resolveMessage) resolveMessage();+ await new Promise((r) => setTimeout(r, 50));++ expect(mockLog.info).toHaveBeenCalledWith(+ "killed by signal (messages=3, tools=1)",+ );++ killSpy.mockRestore();+ exitSpy.mockRestore();+ });++ it("logs 'default' when model is empty", async () => {+ setupBackend([], {+ status: "completed",+ output: "Done",+ error: "",+ durationMs: 100,+ sessionId: "sess-1",+ });++ await runSession(makeInput({ model: "" }));++ expect(mockLog.info).toHaveBeenCalledWith(+ expect.stringContaining("model=default"),+ );+ });+ });});diff --git a/src/cli/daemon/session-runner.ts b/src/cli/daemon/session-runner.tsindex fbf47c245..f2a6d95b5 100644--- a/src/cli/daemon/session-runner.ts+++ b/src/cli/daemon/session-runner.ts@@ -6,7 +6,6 @@* log capture, and server completion reporting.*/-import { createWriteStream } from "fs";import { mkdir, writeFile, rm } from "fs/promises";import path from "path";import { DaemonClient } from "./client.js";@@ -16,7 +15,6 @@ import {initEntryAsync,updateEntry,createTimelineEntry,- localISOString,findResumableSessionByContextKey,} from "./execenv/timeline.js";import { buildPrompt } from "./prompt.js";@@ -66,10 +64,12 @@ async function downloadAttachments(export async function runSession(input: SessionRunnerInput): Promise<void> {const { task, provider, cliPath, model, serverURL, token, workspacesRoot, agentTimeout } = input;+ log.info(`starting (task=${task.id}, type=${task.type}, agent=${task.agentId}, provider=${provider}, model=${model || "default"})`);+const client = new DaemonClient(serverURL);const backend = createBackend(provider, cliPath);- const { workDir, logFile, timelineDir, env } = prepare(+ const { workDir, timelineDir, env } = prepare({ workspacesRoot },task,);@@ -78,12 +78,14 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {const attachmentIds = (task.context?.attachment_ids as string[]) ?? [];let attachments: Attachment[] | undefined;if (attachmentIds.length > 0) {+ log.info(`downloading ${attachmentIds.length} attachment(s)`);try {attachments = await downloadAttachments(client, token, task.workspaceId, task.id, attachmentIds);+ log.info(`attachments ready (${attachments.length} file(s))`);} catch (e) {await cleanupAttachments(task.id);const errMsg = `failed to download attachments: ${e}`;- log.error(`Task ${task.id} ${errMsg}`);+ log.error(errMsg);await client.failTask(token, task.id, errMsg);return;}@@ -95,7 +97,7 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {? findResumableSessionByContextKey(timelineDir, task.contextKey, provider) ?? undefined: undefined;if (resumeSessionId) {- log.info(`Task ${task.id} resuming session ${resumeSessionId} (context_key: ${task.contextKey})`);+ log.info(`resuming session ${resumeSessionId} (context_key: ${task.contextKey})`);}const session = backend.execute(prompt, {@@ -111,9 +113,11 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {// Timeline init — use process.pid (session runner PID), not the inner agent PIDconst earlySessionId = await session.sessionId;+ log.info(`agent started (pid=${agentPid ?? "unknown"}, session=${earlySessionId})`);+ log.info(JSON.stringify({ role: "user", type: "text", content: prompt }));await initEntryAsync(timelineDir,- createTimelineEntry(task.id, task.prompt, task.type, earlySessionId, process.pid, provider, task.contextKey),+ createTimelineEntry(task.id, task.prompt, task.type, earlySessionId, process.pid, provider, task.contextKey, input.logFilePath),);// Message batching@@ -127,6 +131,7 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {output?: string;}[] = [];let seq = 0;+ let toolCount = 0;const BATCH_SIZE = Number(process.env.ALOOK_MESSAGE_BATCH_SIZE) || 20;const FLUSH_INTERVAL_MS = Number(process.env.ALOOK_MESSAGE_FLUSH_INTERVAL_MS) || 100;@@ -136,34 +141,18 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {try {await client.reportMessages(token, task.id, batch);} catch (e) {- log.debug(`Task ${task.id} message report failed`, e);+ log.debug("message report failed", e);}};const flushTimer = setInterval(flushMessages, FLUSH_INTERVAL_MS);- // Log capture — append JSONL to agent.log (best-effort)- let logStream: ReturnType<typeof createWriteStream> | undefined;- try {- logStream = createWriteStream(logFile, { flags: "a" });- logStream.write(- JSON.stringify({- ts: localISOString(),- type: "text",- role: "user",- content: prompt,- }) + "\n",- );- } catch {- logStream = undefined;- }-// --- Graceful shutdown on SIGTERM/SIGINT ---let killed = false;const onKill = async () => {if (killed) return;killed = true;- log.info(`Task ${task.id} killed by signal`);+ log.info(`killed by signal (messages=${seq}, tools=${toolCount})`);// 1. Kill the inner agent processif (agentPid) {@@ -173,7 +162,6 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {// 2. Flush any pending messagesclearInterval(flushTimer);try { await flushMessages(); } catch { /* best-effort */ }- logStream?.end();// 3. Cleanup attachmentsawait cleanupAttachments(task.id);@@ -209,6 +197,9 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {output: msg.output,});+ if (msg.type === "tool-use") toolCount++;+ log.info(JSON.stringify({ role: "assistant", ...msg }));+// Timeline — record assistant text messagesif (msg.type === "text" && msg.content) {updateEntry(timelineDir, task.id, (entry) => {@@ -216,20 +207,6 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {});}- if (logStream) {- try {- logStream.write(- JSON.stringify({- ts: localISOString(),- role: "assistant",- ...msg,- }) + "\n",- );- } catch {- // skip logging on write failure- }- }-if (pendingMessages.length >= BATCH_SIZE) {await flushMessages();}@@ -238,7 +215,6 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {if (!killed) await flushMessages();} finally {clearInterval(flushTimer);- logStream?.end();process.removeListener("SIGTERM", onKill);process.removeListener("SIGINT", onKill);}@@ -283,10 +259,12 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {if (result.sessionId) body.session_id = result.sessionId;// branchName is currently always undefined — forward-compat passthroughawait client.completeTask(token, task.id, body);- log.info(`Task ${task.id} completed`);+ const dur = (result.durationMs / 1000).toFixed(1);+ log.info(`completed (duration=${dur}s, messages=${seq}, tools=${toolCount})`);} else {await client.failTask(token, task.id, result.error || "unknown error");- log.info(`Task ${task.id} failed — ${result.error}`);+ const dur = (result.durationMs / 1000).toFixed(1);+ log.info(`failed (duration=${dur}s, messages=${seq}, tools=${toolCount}) — ${result.error}`);}}diff --git a/src/cli/daemon/types.ts b/src/cli/daemon/types.tsindex c577549f1..727217159 100644--- a/src/cli/daemon/types.ts+++ b/src/cli/daemon/types.ts@@ -95,6 +95,7 @@ export interface SessionRunnerInput {token: string;workspacesRoot: string;agentTimeout: number;+ logFilePath?: string;}/** Convert a validated TaskApi (snake_case wire format) to the internal Task type. */diff --git a/src/cli/lib/logger.test.ts b/src/cli/lib/logger.test.tsindex 542dffa31..b6e2cd2ed 100644--- a/src/cli/lib/logger.test.ts+++ b/src/cli/lib/logger.test.ts@@ -32,7 +32,7 @@ describe("Logger", () => {logger.info("hello world");const output = stdoutSpy.mock.calls[0][0] as string;- expect(output).toMatch(/^\d{2}:\d{2}:\d{2} INFO hello world\n$/);+ expect(output).toMatch(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} INFO hello world\n$/);});it("writes error level to stderr", () => {diff --git a/src/cli/lib/logger.ts b/src/cli/lib/logger.tsindex 4089b007f..b03efef68 100644--- a/src/cli/lib/logger.ts+++ b/src/cli/lib/logger.ts@@ -33,10 +33,13 @@ function useColor(): boolean {function timestamp(): string {const d = new Date();+ const Y = d.getFullYear();+ const M = String(d.getMonth() + 1).padStart(2, "0");+ const D = String(d.getDate()).padStart(2, "0");const h = String(d.getHours()).padStart(2, "0");const m = String(d.getMinutes()).padStart(2, "0");const s = String(d.getSeconds()).padStart(2, "0");- return `${h}:${m}:${s}`;+ return `${Y}-${M}-${D} ${h}:${m}:${s}`;}export class Logger {