mirror of
https://github.com/versia-pub/server.git
synced 2025-12-07 08:48:19 +01:00
Create logfile if it doesnt exist
This commit is contained in:
parent
53cd73262c
commit
6b2e4044b6
|
|
@ -42,10 +42,13 @@ export class LogManager {
|
||||||
if (this.output == Bun.stdout) {
|
if (this.output == Bun.stdout) {
|
||||||
await Bun.write(Bun.stdout, text + "\n");
|
await Bun.write(Bun.stdout, text + "\n");
|
||||||
} else {
|
} else {
|
||||||
if (!this.output.name) {
|
if (!(await this.output.exists())) {
|
||||||
throw new Error(`Output file doesnt exist (and isnt stdout)`);
|
// 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue