feat(server): migrate all logging to pino
- Add pino with pino-pretty for structured logging
- Create root logger in index.ts with child loggers per module
- Support log level via PASEO_LOG env var and config.json
- Support log format (pretty/json) via PASEO_LOG_FORMAT and config.json
- Replace all console.* in runtime code with appropriate log levels
- Scripts use process.stdout/stderr for output
- Error logging uses correct pattern: logger.error({ err }, msg)
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
SessionInboundMessageSchema,
|
||||
WSOutboundMessageSchema,
|
||||
} from "../shared/messages.js";
|
||||
import { getRootLogger } from "../server/logger.js";
|
||||
import type {
|
||||
AgentStreamEventPayload,
|
||||
AgentSnapshotPayload,
|
||||
@@ -39,6 +40,8 @@ import type {
|
||||
} from "../server/agent/agent-sdk-types.js";
|
||||
import { getAgentProviderDefinition } from "../server/agent/provider-manifest.js";
|
||||
|
||||
const logger = getRootLogger().child({ module: "daemon-client" });
|
||||
|
||||
export type DaemonTransport = {
|
||||
send: (data: string) => void;
|
||||
close: (code?: number, reason?: string) => void;
|
||||
@@ -1409,7 +1412,7 @@ export class DaemonClientV2 {
|
||||
const parsed = WSOutboundMessageSchema.safeParse(parsedJson);
|
||||
if (!parsed.success) {
|
||||
const msgType = (parsedJson as { message?: { type?: string } })?.message?.type ?? "unknown";
|
||||
console.warn(`[DaemonClientV2] Message validation failed for "${msgType}":`, parsed.error.message);
|
||||
logger.warn({ msgType, error: parsed.error.message }, "Message validation failed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user