mirror of
https://github.com/versia-pub/server.git
synced 2025-12-07 00:48:18 +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) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue