created logger.ts

moved the added stream part directly into the config of morgan in app.ts.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
Philip Molares 2020-04-11 20:08:57 +02:00 committed by David Mehren
parent bb8297dca3
commit 637833ab18
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB
2 changed files with 7 additions and 9 deletions

View file

@ -56,7 +56,11 @@ if (config.useSSL) {
// logger // logger
app.use(morgan('combined', { app.use(morgan('combined', {
'stream': logger.stream stream: {
write: function (message): void {
logger.info(message)
}
}
})) }))
// socket io // socket io

View file

@ -1,5 +1,5 @@
'use strict' 'use strict'
const { createLogger, format, transports } = require('winston') import { createLogger, format, transports } from 'winston'
const logger = createLogger({ const logger = createLogger({
level: 'debug', level: 'debug',
@ -18,10 +18,4 @@ const logger = createLogger({
exitOnError: false exitOnError: false
}) })
logger.stream = { export { logger }
write: function (message, encoding) {
logger.info(message)
}
}
module.exports = logger