Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@treelab/logger-metrics-middleware

Package Overview
Dependencies
Maintainers
12
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@treelab/logger-metrics-middleware - npm Package Compare versions

Comparing version 1.0.2-beta to 1.0.4-beta

28

dist/http-logger.js

@@ -17,3 +17,2 @@ "use strict";

const metrics_1 = require("./metrics");
const kafka_interface_1 = require("@nestjs/microservices/external/kafka.interface");
const skipPaths = [

@@ -61,2 +60,3 @@ '/',

const _message = JSON.parse(_resBody.errors[0].message);
log.err = { message: _message };
if (_message.status && _message.status >= 500) {

@@ -103,4 +103,6 @@ _statusCode = 500;

catch (err) {
log.level = kafka_interface_1.logLevel.ERROR;
log.err = err;
log = addOptional(ctx.request, ctx);
log.duration = Date.now() - startTime;
log.level = interfaces_1.LogLevel.ERROR;
log.err = { message: err.message, stack: err.stack };
status = err.status || 500;

@@ -118,12 +120,12 @@ const code = err.code || 'SYSTEM_ERROR';

finally {
metrics_1.histogram.labels(log.customTag, 'http', log.transaction, status.toString()).observe(log.duration);
if (options.prettyPrint) {
console.log(log);
}
else {
try {
try {
metrics_1.histogram.labels(log.customTag, 'http', log.transaction, status.toString()).observe(log.duration);
if (options.prettyPrint) {
console.log(log);
}
else {
console.log(JSON.stringify(log));
}
catch (_a) { }
}
catch (_a) { }
}

@@ -146,8 +148,2 @@ });

};
if (ctx) {
ctx.req.locals.requestId = log.requestId;
}
else {
req.locals.requestId = log.requestId;
}
let authorization = req.headers['authorization'] || '';

@@ -154,0 +150,0 @@ if (authorization) {

{
"name": "@treelab/logger-metrics-middleware",
"description": "nest js logger-metrics-middleware",
"version": "1.0.2-beta",
"version": "1.0.4-beta",
"author": "simon.shi <simon.shi@treelab.co>",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/treelab/treelab-infra-utils/tree/master/treelab-log-metrics",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc