@open-norantec/herbal 1.0.2-alpha.4 → 1.0.2-alpha.6

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.
@@ -102,9 +102,6 @@ var ControllerInterceptor = (function () {
102
102
  _.attempt(function () {
103
103
  _this.getLogger().log("[trace:".concat(request === null || request === void 0 ? void 0 : request.traceId, ":response:url] ").concat(request === null || request === void 0 ? void 0 : request.originalUrl));
104
104
  });
105
- _.attempt(function () {
106
- return _this.getLogger().log("[trace:".concat(request === null || request === void 0 ? void 0 : request.traceId, ":request:body] ").concat(JSON.stringify(request === null || request === void 0 ? void 0 : request.body)));
107
- });
108
105
  _.attempt(function () {
109
106
  return _this.getLogger().log("[trace:".concat(request === null || request === void 0 ? void 0 : request.traceId, ":request:headers] ").concat(JSON.stringify(request === null || request === void 0 ? void 0 : request.headers)));
110
107
  });
@@ -139,6 +136,7 @@ var ControllerInterceptor = (function () {
139
136
  _.attempt(function () {
140
137
  _this.getLogger().error("[trace:".concat(request === null || request === void 0 ? void 0 : request.traceId, ":response:error:stack] ").concat(error === null || error === void 0 ? void 0 : error.stack));
141
138
  });
139
+ _this.getLogger().error("Got error when handling route in interceptor: ".concat(error === null || error === void 0 ? void 0 : error.message, " ").concat(error === null || error === void 0 ? void 0 : error.stack));
142
140
  _.attempt(function () { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = request === null || request === void 0 ? void 0 : request.transaction) === null || _a === void 0 ? void 0 : _a.rollback) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.catch) === null || _d === void 0 ? void 0 : _d.call(_c, function () { }); });
143
141
  return (0, rxjs_1.throwError)(function () { return error; });
144
142
  }));
@@ -229,6 +227,7 @@ function HerbalGuard(options) {
229
227
  else {
230
228
  request.rawBody = null;
231
229
  }
230
+ _.attempt(function () { return _this.getLogger().log("[trace:".concat(request === null || request === void 0 ? void 0 : request.traceId, ":request:body] ").concat(request.rawBody)); });
232
231
  authAdapters = auth_adapter_decorator_1.AuthAdapters.getAdapters((_g = (_f = context === null || context === void 0 ? void 0 : context.getClass) === null || _f === void 0 ? void 0 : _f.call(context)) === null || _g === void 0 ? void 0 : _g.prototype, request.methodName);
233
232
  _m.label = 18;
234
233
  case 18:
@@ -259,6 +258,7 @@ function HerbalGuard(options) {
259
258
  _m.label = 25;
260
259
  case 25:
261
260
  _m.trys.push([25, 27, , 28]);
261
+ this.getLogger().error("Got error when handling route: ".concat(error_1 === null || error_1 === void 0 ? void 0 : error_1.message, " ").concat(error_1 === null || error_1 === void 0 ? void 0 : error_1.stack));
262
262
  return [4, ((_h = transaction === null || transaction === void 0 ? void 0 : transaction.rollback) === null || _h === void 0 ? void 0 : _h.call(transaction))];
263
263
  case 26:
264
264
  _m.sent();
@@ -272,6 +272,16 @@ function HerbalGuard(options) {
272
272
  });
273
273
  });
274
274
  };
275
+ HerbalGuardMixin.prototype.getLogger = function () {
276
+ var loggerService = this.ref.get(logger_service_1.LoggerService, { strict: false });
277
+ if (!(loggerService instanceof logger_service_1.LoggerService)) {
278
+ return {
279
+ log: function () { },
280
+ error: function () { },
281
+ };
282
+ }
283
+ return loggerService;
284
+ };
275
285
  HerbalGuardMixin = __decorate([
276
286
  (0, common_2.Injectable)(),
277
287
  __metadata("design:paramtypes", [core_1.ModuleRef])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-norantec/herbal",
3
- "version": "1.0.2-alpha.4",
3
+ "version": "1.0.2-alpha.6",
4
4
  "description": "Herbal is a builder and toolchain for Nest.js applications",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {