aboutsummaryrefslogtreecommitdiff
path: root/src/files.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/files.ts')
-rw-r--r--src/files.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/files.ts b/src/files.ts
index daab817..fb22013 100644
--- a/src/files.ts
+++ b/src/files.ts
@@ -1,6 +1,7 @@
import * as fs from 'fs';
const CONTENT_BASE_DIRECTORY: string = './files';
+const LOG_BASE_DIRECTORY: string = './logs';
const path: (filename: string, projectName: string) => string
= (filename: string, projectName: string): string => {
@@ -13,10 +14,20 @@ const writableStream:
return fs.createWriteStream(path(filename, projectName));
};
+const logPath:
+ (type: string, projectName?: string) => string =
+ (type: string, projectName?: string): string => {
+ return projectName
+ ? `${LOG_BASE_DIRECTORY}/projects/${projectName}/${type}`
+ : `${LOG_BASE_DIRECTORY}/general/${type}`;
+};
+
export const files: {
path: (f: string, p: string) => string;
writableStream: (f: string, p: string) => fs.WriteStream;
+ logPath: (t: string, p?: string) => string;
} = {
path,
- writableStream
+ writableStream,
+ logPath
};