Download packages/acp-server/src/log.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 801 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/acp-server/src/log.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/acp-server/src/log.ts
-
curl -L -o log.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/acp-server/src/log.ts
801 Bytes
| /** | |
| * acp-server diagnostic logger — writes structured lines to **stderr**. | |
| * | |
| * Stdout is the ACP JSON-RPC channel and must stay clean, so adapter | |
| * diagnostics go to stderr. Kept tiny (and dependency-free) on purpose; the | |
| * shape mirrors the `log.warn(msg, ctx)` call sites used throughout the | |
| * adapter. | |
| */ | |
| function write(level: string, msg: string, ctx?: Record<string, unknown>): void { | |
| const line = JSON.stringify({ level, msg, ...ctx }); | |
| process.stderr.write(`${line}\n`); | |
| } | |
| export const log = { | |
| warn(msg: string, ctx?: Record<string, unknown>): void { | |
| write('warn', msg, ctx); | |
| }, | |
| error(msg: string, ctx?: Record<string, unknown>): void { | |
| write('error', msg, ctx); | |
| }, | |
| info(msg: string, ctx?: Record<string, unknown>): void { | |
| write('info', msg, ctx); | |
| }, | |
| }; | |