diff options
| author | cjd24 | 2018-04-19 21:01:12 +0100 |
|---|---|---|
| committer | cjd24 | 2018-04-19 21:01:12 +0100 |
| commit | 1416af119d500ea6e7983262a7ebab3ab35c0500 (patch) | |
| tree | ba7f6d4b86cc0eb1ec35c407ed59af4af90e996c /src | |
| parent | Merge branch 'cjd24/conversion' of https://gitlab.cs.st-andrews.ac.uk/cs3099g... (diff) | |
| parent | fixed test-crash (diff) | |
| download | medicine-1416af119d500ea6e7983262a7ebab3ab35c0500.tar.gz medicine-1416af119d500ea6e7983262a7ebab3ab35c0500.zip | |
adding trh/gets into mine to get the additional CORS stuff
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.ts | 1 | ||||
| -rw-r--r-- | src/files.ts | 10 | ||||
| -rw-r--r-- | src/logger.ts | 8 |
3 files changed, 14 insertions, 5 deletions
@@ -81,6 +81,7 @@ class App { 'Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept' ); + res.header('Access-Control-Allow-Methods', '*'); next(); }); } diff --git a/src/files.ts b/src/files.ts index 5b15a10..e87d8da 100644 --- a/src/files.ts +++ b/src/files.ts @@ -32,12 +32,20 @@ const readableStream: (filename: string, projectName: string, { offset, length } return fs.createReadStream(path(filename, projectName), options); }; -const logPath: (type: string, projectName?: string) => string = ( +export function logPath (type: string, projectName?: string){ + return projectName + ? `${LOG_BASE_DIRECTORY}/projects/${projectName}/${type}` + : `${LOG_BASE_DIRECTORY}/general/${type}`; +} + +/* +export 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}`; }; +*/ let storage = Multer.diskStorage({ destination: function (req, file, cb) { diff --git a/src/logger.ts b/src/logger.ts index 74ae1f7..ba66650 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -3,7 +3,7 @@ import * as colors from 'colors/safe'; import * as winston from 'winston'; -import { files } from './files'; +import { logPath } from './files'; import { QueryOptions } from 'sequelize'; type Colour = (s: string) => string; @@ -143,7 +143,7 @@ const basicFileTransport: winston.TransportInstance = silent: false, colorize: false, timestamp: true, - filename: files.logPath('basic'), + filename: './logs/general/basic',//logPath('basic'), maxSize: 1000000, maxFiles: 100, stream: undefined, @@ -170,7 +170,7 @@ const criticalFileTransport: winston.TransportInstance = silent: false, colorize: false, timestamp: true, - filename: files.logPath('critical'), + filename: './logs/general/critical' ,//logPath('critical'), maxSize: 1000000, maxFiles: 10, stream: undefined, @@ -198,7 +198,7 @@ const queryFileTransport: winston.TransportInstance = silent: false, colorize: false, timestamp: true, - filename: files.logPath('queries'), + filename: './logs/general/queries',//logPath('queries'), maxSize: 1000000, maxFiles: 100, stream: undefined, |
