diff --git a/packages/log-manager/index.ts b/packages/log-manager/index.ts index 37d03e1d..11d34196 100644 --- a/packages/log-manager/index.ts +++ b/packages/log-manager/index.ts @@ -42,10 +42,13 @@ export class LogManager { if (this.output == Bun.stdout) { await Bun.write(Bun.stdout, text + "\n"); } else { - if (!this.output.name) { - throw new Error(`Output file doesnt exist (and isnt stdout)`); + if (!(await this.output.exists())) { + // Create file if it doesn't exist + await Bun.write(this.output, "", { + createPath: true, + }); } - await appendFile(this.output.name, text + "\n"); + await appendFile(this.output.name ?? "", text + "\n"); } }