@duvdu-v1/duvdu 1.1.118 → 1.1.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logger = void 0;
|
|
7
|
+
const winston_1 = __importDefault(require("winston"));
|
|
8
|
+
const winston_daily_rotate_file_1 = __importDefault(require("winston-daily-rotate-file"));
|
|
9
|
+
exports.logger = winston_1.default.createLogger({
|
|
10
|
+
format: winston_1.default.format.combine(winston_1.default.format.timestamp(), winston_1.default.format.errors({ stack: true }), winston_1.default.format.simple(), winston_1.default.format.printf((info) => {
|
|
11
|
+
if (info.stack) {
|
|
12
|
+
return `${info.timestamp} [${info.level.toUpperCase()}]: ${info.message}\n${info.stack}`;
|
|
13
|
+
}
|
|
14
|
+
return `${info.timestamp} [${info.level.toUpperCase()}]: ${info.message}`;
|
|
15
|
+
})),
|
|
16
|
+
transports: [
|
|
17
|
+
// new winston.transports.Console({ level: 'debug', format: winston.format.simple() }),
|
|
18
|
+
// new winston.transports.File({ filename: 'logs/logfile.log' }),
|
|
19
|
+
new winston_daily_rotate_file_1.default({
|
|
20
|
+
filename: 'logs/logfile-%DATE%.log',
|
|
21
|
+
datePattern: 'YYYY-MM-DD',
|
|
22
|
+
zippedArchive: false,
|
|
23
|
+
maxSize: '20m',
|
|
24
|
+
maxFiles: '10d',
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
});
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -92,3 +92,4 @@ __exportStar(require("./events/new-notification.event"), exports);
|
|
|
92
92
|
__exportStar(require("./events/base-listener"), exports);
|
|
93
93
|
__exportStar(require("./events/base-publisher"), exports);
|
|
94
94
|
__exportStar(require("./events/subject"), exports);
|
|
95
|
+
__exportStar(require("./config/winston"), exports);
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.globalErrorHandlingMiddleware = void 0;
|
|
4
4
|
const multer_1 = require("multer");
|
|
5
|
+
const winston_1 = require("../config/winston");
|
|
5
6
|
const custom_error_1 = require("../errors/custom-error");
|
|
6
7
|
// eslint-disable-next-line
|
|
7
8
|
const globalErrorHandlingMiddleware = (err, req, res, next) => {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
if (process.env.NODE_ENV === 'development')
|
|
10
|
+
console.log(err);
|
|
11
|
+
winston_1.logger.error(err);
|
|
10
12
|
// custom error
|
|
11
13
|
if (err instanceof custom_error_1.CustomError) {
|
|
12
14
|
return res.status(err.statusCode).json({ errors: err.serializeError() });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duvdu-v1/duvdu",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.120",
|
|
4
4
|
"main": "./build/index.js",
|
|
5
5
|
"types": "./build/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
"redis": "^4.6.13",
|
|
41
41
|
"rimraf": "^5.0.5",
|
|
42
42
|
"typescript": "^5.3.3",
|
|
43
|
-
"uuid": "^9.0.1"
|
|
43
|
+
"uuid": "^9.0.1",
|
|
44
|
+
"winston": "^3.13.0",
|
|
45
|
+
"winston-daily-rotate-file": "^5.0.0"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@types/uuid": "^9.0.8",
|