forked from piotr-bocian/Projekt-4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrorLogging.js
More file actions
26 lines (25 loc) · 884 Bytes
/
errorLogging.js
File metadata and controls
26 lines (25 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const winston = require('winston');
require('winston-mongodb');
require('express-async-errors');
const { transports, format, transport } = require('winston');
module.exports = function() {
winston.configure({
format: winston.format.combine(
format.timestamp(),
format.json()
),
transports: [
new winston.transports.File({filename: 'logfile.log'}),
new winston.transports.Console({format: winston.format.simple()}),
new winston.transports.MongoDB({
db: process.env.MONGODB_URI,
level: 'error'
})
],
exceptionHandlers: [
new winston.transports.File({ filename: 'uncaughtExceptions.log' })
],
rejectionHandlers: [
new winston.transports.File({ filename: 'uncaughtExceptions.log'})
]});
};