(message: string, ...args: unknown[])
| 32 | : undefined |
| 33 | |
| 34 | function log(message: string, ...args: unknown[]): void { |
| 35 | if (LOG_FILE) { |
| 36 | const timestamp = new Date().toISOString() |
| 37 | const formattedArgs = args.length > 0 ? ' ' + jsonStringify(args) : '' |
| 38 | const logLine = `[${timestamp}] [Claude Chrome Native Host] ${message}${formattedArgs}\n` |
| 39 | // Fire-and-forget: logging is best-effort and callers (including event |
| 40 | // handlers) don't await |
| 41 | void appendFile(LOG_FILE, logLine).catch(() => { |
| 42 | // Ignore file write errors |
| 43 | }) |
| 44 | } |
| 45 | console.error(`[Claude Chrome Native Host] ${message}`, ...args) |
| 46 | } |
| 47 | /** |
| 48 | * Send a message to stdout (Chrome native messaging protocol) |
| 49 | */ |
no test coverage detected