added unit testing, and started implementing unit tests...phew
This commit is contained in:
31
dist/server/logger.js
vendored
Normal file
31
dist/server/logger.js
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var { winston, transports, createLogger, format } = require('winston');
|
||||
var path = require('path');
|
||||
// Set this to whatever, by default the path of the script.
|
||||
var logPath = './logs/';
|
||||
const tsFormat = () => (new Date().toISOString());
|
||||
const errorLog = createLogger({
|
||||
format: format.combine(format.timestamp(), format.json()),
|
||||
transports: [
|
||||
new transports.File({
|
||||
filename: path.join(logPath, 'errors.log'),
|
||||
timestamp: tsFormat,
|
||||
level: 'debug'
|
||||
})
|
||||
]
|
||||
});
|
||||
const accessLog = createLogger({
|
||||
format: format.combine(format.timestamp(), format.json()),
|
||||
transports: [
|
||||
new transports.File({
|
||||
filename: path.join(logPath, 'access.log'),
|
||||
timestamp: tsFormat,
|
||||
level: 'info'
|
||||
})
|
||||
]
|
||||
});
|
||||
module.exports = {
|
||||
errorLog: errorLog,
|
||||
accessLog: accessLog
|
||||
};
|
||||
//# sourceMappingURL=logger.js.map
|
Reference in New Issue
Block a user