@riocrypto/common-server 1.0.2925 → 1.0.2927
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.
package/build/services/logger.js
CHANGED
|
@@ -278,6 +278,22 @@ class LoggerService {
|
|
|
278
278
|
// Bearer tokens: Bearer <token>
|
|
279
279
|
/(\bBearer\s+)([^\s,;"]+)/gi,
|
|
280
280
|
];
|
|
281
|
+
// Cloud Logging reads a top level "severity" field from JSON stdout lines.
|
|
282
|
+
// Without it every stdout line is stored as INFO and stderr as ERROR.
|
|
283
|
+
this.gcpSeverity = (0, winston_1.format)((info) => {
|
|
284
|
+
var _a;
|
|
285
|
+
const severities = {
|
|
286
|
+
error: "ERROR",
|
|
287
|
+
warn: "WARNING",
|
|
288
|
+
info: "INFO",
|
|
289
|
+
http: "INFO",
|
|
290
|
+
verbose: "DEBUG",
|
|
291
|
+
debug: "DEBUG",
|
|
292
|
+
silly: "DEBUG",
|
|
293
|
+
};
|
|
294
|
+
info.severity = (_a = severities[info.level]) !== null && _a !== void 0 ? _a : "DEFAULT";
|
|
295
|
+
return info;
|
|
296
|
+
});
|
|
281
297
|
this.logger = null;
|
|
282
298
|
this.setupConsoleMasking();
|
|
283
299
|
this.setupStreamMasking();
|
|
@@ -453,11 +469,16 @@ class LoggerService {
|
|
|
453
469
|
service: process.env.OTEL_SERVICE_NAME,
|
|
454
470
|
}));
|
|
455
471
|
}
|
|
472
|
+
// One JSON line per log event. prettyPrint spreads each event over many
|
|
473
|
+
// stdout lines and Cloud Logging stores and bills every line as its own
|
|
474
|
+
// entry with roughly 800 bytes of metadata, which multiplied ingestion
|
|
475
|
+
// volume by 7x to 25x depending on the service.
|
|
476
|
+
const outputFormat = process.env.RIO_ENV === common_1.RioEnv.Local ? winston_1.format.prettyPrint() : winston_1.format.json();
|
|
456
477
|
this.logger = (0, winston_1.createLogger)({
|
|
457
478
|
level: logLevel,
|
|
458
479
|
format: winston_1.format.combine(winston_1.format.timestamp(), this.maskSensitiveData(), this.requestMethodFilter(), // Add the request method filter
|
|
459
480
|
this.handleCustomErrorFormat(), // Add the custom error format
|
|
460
|
-
|
|
481
|
+
this.gcpSeverity(), outputFormat),
|
|
461
482
|
transports: transportsArray,
|
|
462
483
|
});
|
|
463
484
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2927",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/secret-manager": "^5.6.0",
|
|
29
29
|
"@google-cloud/storage": "^7.19.0",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.10.3",
|
|
31
|
-
"@riocrypto/common": "1.0.
|
|
31
|
+
"@riocrypto/common": "1.0.2728",
|
|
32
32
|
"@slack/web-api": "^7.15.0",
|
|
33
33
|
"@types/express": "^4.17.25",
|
|
34
34
|
"axios": "1.18.1",
|