Fix logs paths (!390)
When compiled natively to linux, logfiles are saved in main SPT folder instead of default location. It's caused by file paths being hardcoded as text. This patch fixes logs location on linux build. Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/390 Co-authored-by: witek <falls-toluene.0q@icloud.com> Co-committed-by: witek <falls-toluene.0q@icloud.com>
This commit is contained in:
parent
6f010acfca
commit
3edf0f2ff9
@ -1,3 +1,4 @@
|
||||
import path from "node:path";
|
||||
import crypto from "node:crypto";
|
||||
import fs from "node:fs";
|
||||
import { promisify } from "node:util";
|
||||
@ -34,7 +35,7 @@ export abstract class AbstractWinstonLogger implements ILogger {
|
||||
protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise<void>;
|
||||
|
||||
constructor(protected asyncQueue: IAsyncQueue) {
|
||||
this.filePath = `${this.getFilePath()}${this.getFileName()}`;
|
||||
this.filePath = path.join(this.getFilePath(), this.getFileName());
|
||||
this.writeFilePromisify = promisify(fs.writeFile);
|
||||
this.showDebugInConsole = globalThis.G_DEBUG_CONFIGURATION;
|
||||
if (!fs.existsSync(this.getFilePath())) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import path from "node:path";
|
||||
import { IAsyncQueue } from "@spt/models/spt/utils/IAsyncQueue";
|
||||
import { AbstractWinstonLogger } from "@spt/utils/logging/AbstractWinstonLogger";
|
||||
import { inject, injectable } from "tsyringe";
|
||||
@ -21,7 +22,7 @@ export class WinstonMainLogger extends AbstractWinstonLogger {
|
||||
}
|
||||
|
||||
protected getFilePath(): string {
|
||||
return "./user/logs/";
|
||||
return path.join("user" ,"logs");
|
||||
}
|
||||
|
||||
protected getFileName(): string {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import path from "node:path";
|
||||
import { IAsyncQueue } from "@spt/models/spt/utils/IAsyncQueue";
|
||||
import { AbstractWinstonLogger } from "@spt/utils/logging/AbstractWinstonLogger";
|
||||
import { inject, injectable } from "tsyringe";
|
||||
@ -21,7 +22,7 @@ export class WinstonRequestLogger extends AbstractWinstonLogger {
|
||||
}
|
||||
|
||||
protected getFilePath(): string {
|
||||
return "./user/logs/requests/";
|
||||
return path.join("user", "logs", "requests");
|
||||
}
|
||||
|
||||
protected getFileName(): string {
|
||||
|
Loading…
Reference in New Issue
Block a user