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