Add logging and some code improvement

This commit is contained in:
Evgenii Abramov
2021-05-16 22:11:46 +03:00
parent 3df4d02934
commit efcff178b6

6
app.js
View File

@@ -4,7 +4,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
/* */ /* */
const {createLogger, format, transports} = require('winston'); const {createLogger, format, transports} = require('winston');
const {combine, timestamp, printf, errors, prettyPrint} = format; const {combine, timestamp, printf, errors} = format;
/* express and https */ /* express and https */
const ejs = require('ejs'); const ejs = require('ejs');
const express = require('express'); const express = require('express');
@@ -33,10 +33,8 @@ global.logger = createLogger({
errors({stack: true}), errors({stack: true}),
timestamp(), timestamp(),
printf(({level, message, timestamp, stack}) => { printf(({level, message, timestamp, stack}) => {
//console.dir(a, {depth: 9});
return `${timestamp} ${level}: ${stack != undefined ? stack : message}`; return `${timestamp} ${level}: ${stack != undefined ? stack : message}`;
}) }),
// prettyPrint()
), ),
transports: [ transports: [
new transports.Console({ new transports.Console({