(filePath?: string)
| 225 | } |
| 226 | |
| 227 | function createLogWriter(filePath?: string): (line: string) => void { |
| 228 | if (!filePath) { |
| 229 | return () => {}; |
| 230 | } |
| 231 | |
| 232 | try { |
| 233 | const stream = createWriteStream(filePath, { flags: "a" }); |
| 234 | stream.on("error", () => {}); |
| 235 | return (line: string) => { |
| 236 | const timestamp = new Date().toISOString(); |
| 237 | const formatted = `[${timestamp}] ${line}`; |
| 238 | stream.write(`${formatted}\n`); |
| 239 | }; |
| 240 | } catch { |
| 241 | return () => {}; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | export interface AccountDebugInfo { |
| 246 | index: number; |