YishTish 9d96ab0983
Nodejs express js packages update (#5675)
* Updated to new nodejs packages, depending heavily on express-openapi-validator. Requires quite a change in code.
Updated the business-logic in the controllers/Controller.js file.
Logger now records also timestamp of events.
Files are uploaded according to definition in config.js file

* Removed commented-out code; Changed openApi document extensions to suit new express-openapi-validator definition; multipart and file uploading is supported now; Automatic response returns the values the were sent in the request

* fixed README documentation, fixed a mistage in package.json/mustache

* added generated files that were created when running the ./bin/test file
2020-03-24 17:37:18 +08:00

22 lines
584 B
JavaScript

const { transports, createLogger, format } = require('winston');
const logger = createLogger({
level: 'info',
format: format.combine(
format.timestamp(),
format.json(),
),
defaultMeta: { service: 'user-service' },
transports: [
new transports.Console(),
new transports.File({ filename: 'error.log', level: 'error', timestamp: true }),
new transports.File({ filename: 'combined.log', timestamp: true }),
],
});
if (process.env.NODE_ENV !== 'production') {
logger.add(new transports.Console({ format: format.simple() }));
}
module.exports = logger;