log file path

This commit is contained in:
Frostebite 2023-05-13 20:57:57 +01:00
parent 4a4b472a1b
commit ae9fef39a3
3 changed files with 7 additions and 1 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -1,14 +1,20 @@
import path from 'node:path'; import path from 'node:path';
import { CloudRunnerFolders } from '../options/cloud-runner-folders';
import CloudRunnerLogger from '../services/core/cloud-runner-logger'; import CloudRunnerLogger from '../services/core/cloud-runner-logger';
import fs from 'node:fs'; import fs from 'node:fs';
import { CloudRunnerSystem } from '../services/core/cloud-runner-system';
export class RemoteClientLogger { export class RemoteClientLogger {
private static get LogFilePath() { private static get LogFilePath() {
return path.join(`/home`, `job-log.txt`); return path.join(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute, `job-log.txt`);
} }
public static log(message: string) { public static log(message: string) {
const finalMessage = `[Client] ${message}`; const finalMessage = `[Client] ${message}`;
if (!fs.existsSync(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute)) {
CloudRunnerSystem.Run(`chmod -R a+rX /data/*`);
fs.mkdirSync(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute);
}
if (!fs.existsSync(this.LogFilePath)) { if (!fs.existsSync(this.LogFilePath)) {
fs.writeFileSync(this.LogFilePath, ``); fs.writeFileSync(this.LogFilePath, ``);
} }