diff options
| author | Dax Raad <[email protected]> | 2025-05-21 10:30:39 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-26 12:40:17 -0400 |
| commit | e01afb407c4b3eb50e85e7356b0be9489fb26eba (patch) | |
| tree | d2aef91ec1894376c4d5a99ea2d11f6ad32b68de /js/src/util | |
| parent | f0f55bc75ff2bbc6690ae61c771a46de7c2bb17d (diff) | |
| download | opencode-e01afb407c4b3eb50e85e7356b0be9489fb26eba.tar.gz opencode-e01afb407c4b3eb50e85e7356b0be9489fb26eba.zip | |
add tool tests
Diffstat (limited to 'js/src/util')
| -rw-r--r-- | js/src/util/log.ts | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/js/src/util/log.ts b/js/src/util/log.ts index d05f42dc2..dff97f962 100644 --- a/js/src/util/log.ts +++ b/js/src/util/log.ts @@ -1,4 +1,3 @@ -import fs from "node:fs"; import path from "node:path"; import { AppPath } from "../app/path"; export namespace Log { @@ -11,16 +10,23 @@ export namespace Log { }, }; - export function file(directory: string) { - return; + export async function file(directory: string) { const out = Bun.file( path.join(AppPath.data(directory), "opencode.out.log"), - ).writer(); + ); const err = Bun.file( path.join(AppPath.data(directory), "opencode.err.log"), - ).writer(); - write["out"] = (msg) => out.write(msg); - write["err"] = (msg) => err.write(msg); + ); + const outWriter = out.writer(); + const errWriter = err.writer(); + write["out"] = (msg) => { + outWriter.write(msg); + outWriter.flush(); + }; + write["err"] = (msg) => { + errWriter.write(msg); + errWriter.flush(); + }; } export function create(tags?: Record<string, any>) { |
