UNPKG

@copilotkit/runtime

Version:

<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />

1 lines 2.72 kB
{"version":3,"file":"logger.cjs","names":[],"sources":["../../../src/v1-deprecated/lib/logger.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — CopilotRuntimeLogger:\n * No 1:1 v2 replacement is available.\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — createLogger:\n * No 1:1 v2 replacement is available.\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LogLevel:\n * No 1:1 v2 replacement is available.\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\n\nimport createPinoLogger from \"pino\";\nimport pretty from \"pino-pretty\";\n\nexport type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\nexport type CopilotRuntimeLogger = ReturnType<typeof createLogger>;\n\nexport function createLogger(options?: {\n level?: LogLevel;\n component?: string;\n}) {\n const { level, component } = options || {};\n const stream = pretty({ colorize: true });\n\n const logger = createPinoLogger(\n {\n level: process.env.LOG_LEVEL || level || \"error\",\n // Drop `pid` and `hostname` with pino's own `base` switch rather than\n // with `redact`. pino 9 validates every redact path by calling\n // `Function(...)`, and edge runtimes such as Cloudflare Workers forbid\n // code generation from strings. That throws while the logger is being\n // built, and the validator reports the first path in the array, so the\n // failure surfaces as the misleading \"redact paths array contains an\n // invalid path (pid)\". `base: null` produces identical output and needs\n // no code generation. See issue #2355.\n base: null,\n },\n stream,\n );\n\n if (component) {\n return logger.child({ component });\n } else {\n return logger;\n }\n}\n"],"mappings":";;;;;;;;AAqCA,SAAgB,aAAa,SAG1B;CACD,MAAM,EAAE,OAAO,cAAc,WAAW,EAAE;CAC1C,MAAM,kCAAgB,EAAE,UAAU,MAAM,CAAC;CAEzC,MAAM,2BACJ;EACE,OAAO,QAAQ,IAAI,aAAa,SAAS;EASzC,MAAM;EACP,EACD,OACD;AAED,KAAI,UACF,QAAO,OAAO,MAAM,EAAE,WAAW,CAAC;KAElC,QAAO"}