@munlib/common 1.0.143 → 1.0.147
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.
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
declare const apmInstance:
|
|
2
|
-
|
|
3
|
-
export { apmInstance, loggerAPM };
|
|
1
|
+
declare const apmInstance: {};
|
|
2
|
+
export { apmInstance };
|
package/build/middlewares/apm.js
CHANGED
|
@@ -1,34 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var winston = require('winston');
|
|
5
|
-
var LogstashTransport = require('logstash-winston-3');
|
|
3
|
+
exports.apmInstance = void 0;
|
|
6
4
|
var apm = require('elastic-apm-node');
|
|
7
|
-
var apmInstance = apm.start({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
5
|
+
var apmInstance = {}; /* apm.start({
|
|
6
|
+
serviceName: process.env.ELK_SERVICE_NAME || 'MUNICIPIO_OBSERVABILIDAD',
|
|
7
|
+
apiKey: process.env.ELK_API_KEY,
|
|
8
|
+
serverUrl: process.env.ELK_SERVER_URL,
|
|
9
|
+
environment: process.env.ELK_ENVIRONMENT || 'DEV',
|
|
10
|
+
logLevel: "error",
|
|
11
|
+
}); */
|
|
14
12
|
exports.apmInstance = apmInstance;
|
|
15
|
-
// Configura el logger
|
|
16
|
-
var loggerAPM = winston.createLogger({
|
|
17
|
-
level: 'info',
|
|
18
|
-
format: winston.format.json(),
|
|
19
|
-
transports: [
|
|
20
|
-
new LogstashTransport({
|
|
21
|
-
level: 'info',
|
|
22
|
-
host: process.env.ELK_SERVER_URL,
|
|
23
|
-
port: 443,
|
|
24
|
-
ssl: true,
|
|
25
|
-
}),
|
|
26
|
-
new winston.transports.Console(),
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
exports.loggerAPM = loggerAPM;
|
|
30
|
-
// Asegúrate de que APM capture logs
|
|
31
|
-
loggerAPM.on('data', function (log) {
|
|
32
|
-
console.log("captura el log......");
|
|
33
|
-
apmInstance.captureError(log);
|
|
34
|
-
});
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.errorHandler = void 0;
|
|
4
4
|
var custom_error_1 = require("../errors/custom-error");
|
|
5
5
|
var erroresStatus_1 = require("../errors/erroresStatus");
|
|
6
|
-
|
|
6
|
+
//import {apmInstance} from './apm';
|
|
7
7
|
var errorHandler = function (err, req, res, next) {
|
|
8
8
|
//ELK LOGS
|
|
9
|
-
|
|
9
|
+
//apmInstance.captureError(err);
|
|
10
10
|
// Manejo de errores personalizados
|
|
11
11
|
if (err instanceof custom_error_1.CustomError) {
|
|
12
12
|
return res.status(err.statusCode).send(err.serializeErrors());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@munlib/common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.147",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"express-validator": "^6.12.0",
|
|
31
31
|
"jsonwebtoken": "^8.5.1",
|
|
32
32
|
"logstash-winston-3": "^2.1.3",
|
|
33
|
-
"winston": "^3.14.2"
|
|
33
|
+
"winston": "^3.14.2",
|
|
34
|
+
"winston-logstash": "^1.2.1"
|
|
34
35
|
}
|
|
35
36
|
}
|