summaryrefslogtreecommitdiffhomepage
path: root/js/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/log.ts20
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>) {