chore: Implement logger with winston library

This commit is contained in:
Faruk AYDIN
2021-10-04 18:01:14 +02:00
committed by Ali BARIN
parent a62d5369d4
commit 7a675e6c79
8 changed files with 254 additions and 65 deletions

View File

@@ -0,0 +1,14 @@
import morgan, { StreamOptions } from 'morgan';
import logger from './logger';
const stream: StreamOptions = {
write: (message) => logger.http(message.substring(0, message.lastIndexOf('\n')))
};
const morganMiddleware = morgan(
":method :url :status :res[content-length] - :response-time ms",
{ stream }
);
export default morganMiddleware;