Replace all console.* calls in src/ with pino child-loggers. Add rootLogger + childLogger(component) in src/runtime/logger.ts. pino-pretty used as dev transport only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
16 lines
400 B
TypeScript
16 lines
400 B
TypeScript
import pino from "pino";
|
|
|
|
export const rootLogger = pino({
|
|
level: process.env.LOG_LEVEL ?? "info",
|
|
transport:
|
|
process.env.NODE_ENV !== "production"
|
|
? { target: "pino-pretty" }
|
|
: undefined,
|
|
});
|
|
|
|
/**
|
|
* Returns a child logger that includes `component` in every log entry.
|
|
*/
|
|
export function childLogger(component: string): pino.Logger {
|
|
return rootLogger.child({ component });
|
|
}
|