@pristine-ts/logging 2.0.2 → 2.0.4

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.
Files changed (49) hide show
  1. package/dist/lib/cjs/handlers/handlers.js +0 -1
  2. package/dist/lib/cjs/handlers/handlers.js.map +1 -1
  3. package/dist/lib/cjs/handlers/log.handler.js +32 -20
  4. package/dist/lib/cjs/handlers/log.handler.js.map +1 -1
  5. package/dist/lib/cjs/interfaces/interfaces.js +0 -1
  6. package/dist/lib/cjs/interfaces/interfaces.js.map +1 -1
  7. package/dist/lib/cjs/models/log.model.js +7 -11
  8. package/dist/lib/cjs/models/log.model.js.map +1 -1
  9. package/dist/lib/cjs/models/models.js +0 -1
  10. package/dist/lib/cjs/models/models.js.map +1 -1
  11. package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  12. package/dist/lib/cjs/utils/utils.js +1 -6
  13. package/dist/lib/cjs/utils/utils.js.map +1 -1
  14. package/dist/lib/esm/handlers/handlers.js +0 -1
  15. package/dist/lib/esm/handlers/handlers.js.map +1 -1
  16. package/dist/lib/esm/handlers/log.handler.js +33 -21
  17. package/dist/lib/esm/handlers/log.handler.js.map +1 -1
  18. package/dist/lib/esm/interfaces/interfaces.js +0 -1
  19. package/dist/lib/esm/interfaces/interfaces.js.map +1 -1
  20. package/dist/lib/esm/models/log.model.js +7 -11
  21. package/dist/lib/esm/models/log.model.js.map +1 -1
  22. package/dist/lib/esm/models/models.js +0 -1
  23. package/dist/lib/esm/models/models.js.map +1 -1
  24. package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
  25. package/dist/lib/esm/utils/utils.js +1 -6
  26. package/dist/lib/esm/utils/utils.js.map +1 -1
  27. package/dist/types/handlers/handlers.d.ts +0 -1
  28. package/dist/types/handlers/log.handler.d.ts +5 -7
  29. package/dist/types/interfaces/interfaces.d.ts +0 -1
  30. package/dist/types/models/log.model.d.ts +6 -9
  31. package/dist/types/models/models.d.ts +0 -1
  32. package/dist/types/types/log-data.type.d.ts +0 -7
  33. package/dist/types/types/output-hints.type.d.ts +6 -3
  34. package/package.json +4 -4
  35. package/dist/lib/cjs/handlers/breadcrumb.handler.js +0 -38
  36. package/dist/lib/cjs/handlers/breadcrumb.handler.js.map +0 -1
  37. package/dist/lib/cjs/interfaces/breadcrumb-handler.interface.js +0 -3
  38. package/dist/lib/cjs/interfaces/breadcrumb-handler.interface.js.map +0 -1
  39. package/dist/lib/cjs/models/breadcrumb.model.js +0 -15
  40. package/dist/lib/cjs/models/breadcrumb.model.js.map +0 -1
  41. package/dist/lib/esm/handlers/breadcrumb.handler.js +0 -35
  42. package/dist/lib/esm/handlers/breadcrumb.handler.js.map +0 -1
  43. package/dist/lib/esm/interfaces/breadcrumb-handler.interface.js +0 -2
  44. package/dist/lib/esm/interfaces/breadcrumb-handler.interface.js.map +0 -1
  45. package/dist/lib/esm/models/breadcrumb.model.js +0 -11
  46. package/dist/lib/esm/models/breadcrumb.model.js.map +0 -1
  47. package/dist/types/handlers/breadcrumb.handler.d.ts +0 -10
  48. package/dist/types/interfaces/breadcrumb-handler.interface.d.ts +0 -21
  49. package/dist/types/models/breadcrumb.model.d.ts +0 -15
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./breadcrumb.handler"), exports);
18
17
  __exportStar(require("./log.handler"), exports);
19
18
  //# sourceMappingURL=handlers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../../src/handlers/handlers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,gDAA8B"}
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../../src/handlers/handlers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
@@ -22,9 +22,10 @@ const common_1 = require("@pristine-ts/common");
22
22
  const utils_1 = require("../utils/utils");
23
23
  const logging_module_1 = require("../logging.module");
24
24
  /**
25
- * The LogHandler to use when we want to output some logs.
26
- * This handler makes sure that only the right level of logs are outputted, stacks logs, and logs with different loggers.
27
- * It is registered with the tag LogHandlerInterface so that it can be injected as a LogHandlerInterface to facilitate mocking.
25
+ * The LogHandler emits structured log entries through every registered `LoggerInterface`.
26
+ * Logs carry their own content (message, severity, eventId, traceId, extra, highlights)
27
+ * nothing more. "What happened around this log" lives in the trace, not the log: use the
28
+ * registered tracers (ConsoleTracer, FileTracer, X-Ray, etc.) to render the span tree.
28
29
  */
29
30
  let LogHandler = class LogHandler {
30
31
  /**
@@ -33,15 +34,13 @@ let LogHandler = class LogHandler {
33
34
  * @param logSeverityLevelConfiguration The severity from which to start logging the logs.
34
35
  * @param activateDiagnostics Whether or not the outputted logs should contain the diagnostic part. This is an intensive process and can dramatically reduce the performance of the code.
35
36
  * @param kernelInstantiationId The id of instantiation of the kernel.
36
- * @param breadcrumbHandler The Breadcrumb handler to get all the latest breadcrumbs.
37
37
  * @param tracingContext The context of the tracing.
38
38
  */
39
- constructor(loggers, logSeverityLevelConfiguration, activateDiagnostics, kernelInstantiationId, breadcrumbHandler, tracingContext) {
39
+ constructor(loggers, logSeverityLevelConfiguration, activateDiagnostics, kernelInstantiationId, tracingContext) {
40
40
  this.loggers = loggers;
41
41
  this.logSeverityLevelConfiguration = logSeverityLevelConfiguration;
42
42
  this.activateDiagnostics = activateDiagnostics;
43
43
  this.kernelInstantiationId = kernelInstantiationId;
44
- this.breadcrumbHandler = breadcrumbHandler;
45
44
  this.tracingContext = tracingContext;
46
45
  }
47
46
  /**
@@ -107,28 +106,37 @@ let LogHandler = class LogHandler {
107
106
  * @param data The data being passed to the log
108
107
  */
109
108
  log(message, severity, data) {
110
- var _a, _b, _c;
109
+ var _a, _b, _c, _d, _e;
111
110
  const log = new log_model_1.LogModel(severity, message);
112
111
  log.kernelInstantiationId = this.kernelInstantiationId;
113
- log.traceId = this.tracingContext.traceId;
112
+ // Resolve the trace id from the active EventContext first (the path forward), with a
113
+ // fallback to the legacy `TracingContext` (the per-child-container service that was
114
+ // the original mechanism). Code that goes through `TracingManager.startTracing` writes
115
+ // both, so the common path works through either branch; the fallback exists for
116
+ // pre-ALS code that sets `tracingContext.traceId` directly without involving the
117
+ // manager. Once `TracingContext` is removed in a future major, this collapses to just
118
+ // the EventContext read.
119
+ log.traceId = (_a = common_1.EventContextManager.traceId()) !== null && _a !== void 0 ? _a : this.tracingContext.traceId;
114
120
  log.date = new Date();
121
+ // Resolve the eventId once. Explicit `data.eventId` always wins (callers that want
122
+ // to log against a different event — e.g. a parent log line during fan-out — keep
123
+ // their override). When the caller didn't pass one, fall back to the active
124
+ // EventContext so we don't have to thread `eventId: request.id` through every call
125
+ // site. Outside any EventContext (e.g. logs from boot, before the pipeline starts),
126
+ // both are undefined and the field is omitted from the output — same as today.
127
+ const resolvedEventId = (_b = data === null || data === void 0 ? void 0 : data.eventId) !== null && _b !== void 0 ? _b : common_1.EventContextManager.eventId();
115
128
  // Handle the data parameter to extract highlights and extra information.
116
129
  if (data) {
117
130
  // Check if data is in the structured format { highlights, extra }
118
131
  if (typeof data === 'object' && data !== null && !Array.isArray(data) && (data.hasOwnProperty('highlights') || data.hasOwnProperty('extra') || data.hasOwnProperty('eventId'))) {
119
- log.highlights = (_a = data.highlights) !== null && _a !== void 0 ? _a : {};
132
+ log.highlights = (_c = data.highlights) !== null && _c !== void 0 ? _c : {};
120
133
  log.extra = data.extra;
121
- log.eventId = data.eventId;
134
+ log.eventId = resolvedEventId;
122
135
  }
123
136
  else {
124
137
  // Otherwise, treat the entire data object as 'extra'
125
138
  log.extra = data;
126
- }
127
- if (data.breadcrumb) {
128
- this.breadcrumbHandler.add(data.eventId, data.breadcrumb);
129
- }
130
- if (data.eventId) {
131
- log.breadcrumbs = this.breadcrumbHandler.breadcrumbs[data.eventId];
139
+ log.eventId = resolvedEventId;
132
140
  }
133
141
  if (data.outputHints) {
134
142
  log.outputHints = data.outputHints;
@@ -137,6 +145,11 @@ let LogHandler = class LogHandler {
137
145
  log.eventGroupId = data.eventGroupId;
138
146
  }
139
147
  }
148
+ else {
149
+ // No `data` arg at all — still attach the eventId from the active context so a
150
+ // bare `logHandler.info("...")` from within a request gets correlated.
151
+ log.eventId = resolvedEventId;
152
+ }
140
153
  // If the activateDiagnostics configuration is set to true, we will include additional information into a __diagnostics path into extra.
141
154
  // This is an intensive process so be careful, it will dramatically slow down your calls.
142
155
  if (this.activateDiagnostics) {
@@ -182,12 +195,12 @@ let LogHandler = class LogHandler {
182
195
  }
183
196
  }
184
197
  catch (error) {
185
- const name = (_c = (_b = logger === null || logger === void 0 ? void 0 : logger.constructor) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : "UnknownLogger";
198
+ const name = (_e = (_d = logger === null || logger === void 0 ? void 0 : logger.constructor) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : "UnknownLogger";
186
199
  const message = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
187
200
  try {
188
201
  process.stderr.write(`[pristine][log-handler] logger '${name}' threw during dispatch: ${message}\n`);
189
202
  }
190
- catch (_d) {
203
+ catch (_f) {
191
204
  // Nothing useful left to do if stderr is unavailable.
192
205
  }
193
206
  }
@@ -204,7 +217,6 @@ exports.LogHandler = LogHandler = __decorate([
204
217
  __param(1, (0, common_1.injectConfig)(logging_configuration_keys_1.LoggingConfigurationKeys.LogSeverityLevelConfiguration)),
205
218
  __param(2, (0, common_1.injectConfig)(logging_configuration_keys_1.LoggingConfigurationKeys.ActivateDiagnostics)),
206
219
  __param(3, (0, tsyringe_1.inject)(common_1.InternalContainerParameterEnum.KernelInstantiationId)),
207
- __param(4, (0, tsyringe_1.inject)("BreadcrumbHandlerInterface")),
208
- __metadata("design:paramtypes", [Array, Number, Boolean, String, Object, common_1.TracingContext])
220
+ __metadata("design:paramtypes", [Array, Number, Boolean, String, common_1.TracingContext])
209
221
  ], LogHandler);
210
222
  //# sourceMappingURL=log.handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.handler.js","sourceRoot":"","sources":["../../../../src/handlers/log.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4BAAyB;AACzB,uCAA0E;AAC1E,8EAAuE;AACvE,0DAAoD;AACpD,mDAA6C;AAE7C,gDAA8I;AAG9I,0CAAqC;AACrC,sDAAuD;AAGvD;;;;GAIG;AAKI,IAAM,UAAU,GAAhB,MAAM,UAAU;IAErB;;;;;;;;OAQG;IACH,YAAgF,OAA0B,EACA,6BAAqC,EAC/C,mBAA4B,EAC1B,qBAA6B,EACrD,iBAA6C,EACnF,cAA8B;QALc,YAAO,GAAP,OAAO,CAAmB;QACA,kCAA6B,GAA7B,6BAA6B,CAAQ;QAC/C,wBAAmB,GAAnB,mBAAmB,CAAS;QAC1B,0BAAqB,GAArB,qBAAqB,CAAQ;QACrD,sBAAiB,GAAjB,iBAAiB,CAA4B;QACnF,mBAAc,GAAd,cAAc,CAAgB;IAClE,CAAC;IAED;;OAEG;IACH,SAAS;QACP,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAuB,EAAE,EAAE;YAC/C,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,OAAe,EAAE,IAAc;QAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,4BAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAe,EAAE,IAAc;QAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,4BAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,OAAe,EAAE,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S,CAAC,eAAe,CAAC;IAWZ,WAAA,IAAA,oBAAS,EAAC,iCAAwB,CAAC,MAAM,CAAC,CAAA;IAC1C,WAAA,IAAA,qBAAY,EAAC,qDAAwB,CAAC,6BAA6B,CAAC,CAAA;IACpE,WAAA,IAAA,qBAAY,EAAC,qDAAwB,CAAC,mBAAmB,CAAC,CAAA;IAC1D,WAAA,IAAA,iBAAM,EAAC,uCAA8B,CAAC,qBAAqB,CAAC,CAAA;qEAC5B,uBAAc;GAdvD,UAAU,CAkMtB"}
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./breadcrumb-handler.interface"), exports);
18
17
  __exportStar(require("./logger.interface"), exports);
19
18
  __exportStar(require("./log-handler.interface"), exports);
20
19
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,qDAAmC;AACnC,0DAAwC"}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,0DAAwC"}
@@ -2,7 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LogModel = void 0;
4
4
  /**
5
- * The model that represents a log
5
+ * The model that represents a log.
6
+ *
7
+ * Logs carry their own content only — no inline breadcrumb trail. To reconstruct "what
8
+ * happened" around a log entry, look at the trace via the registered tracers
9
+ * (ConsoleTracer, FileTracer, X-Ray, etc.) using the `traceId`/`eventId` on the log.
6
10
  */
7
11
  class LogModel {
8
12
  /**
@@ -20,25 +24,17 @@ class LogModel {
20
24
  /**
21
25
  * The module from which the log originated.
22
26
  * By default it will be the application module.
23
- * @deprecated: Use breadcrumbs instead.
24
27
  */
25
28
  this.module = "application";
26
- /**
27
- * The list of breadcrumbs that led to this log.
28
- */
29
- this.breadcrumbs = [];
30
29
  /**
31
30
  * This is an object that is data that you want to "highlights" and show as logs. Select and be careful about what
32
31
  * you choose to highlight to avoid showing to many useless things.
33
32
  */
34
33
  this.highlights = {};
35
34
  /**
36
- * Define output hints that can be overriden. It's not authoritative. For example, even though outputBreadcrumbs might
37
- * be false, if there's an error, the logger might decide to show them anyway.
35
+ * Output hints that loggers may use. Not authoritative; loggers retain final say.
38
36
  */
39
- this.outputHints = {
40
- outputBreadcrumbs: false,
41
- };
37
+ this.outputHints = {};
42
38
  }
43
39
  }
44
40
  exports.LogModel = LogModel;
@@ -1 +1 @@
1
- {"version":3,"file":"log.model.js","sourceRoot":"","sources":["../../../../src/models/log.model.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,MAAa,QAAQ;IAyDnB;;;;OAIG;IACH,YAAmB,QAAsB,EAAS,OAAe;QAA9C,aAAQ,GAAR,QAAQ,CAAc;QAAS,YAAO,GAAP,OAAO,CAAQ;QAzCjE;;WAEG;QACH,SAAI,GAAS,IAAI,IAAI,EAAE,CAAC;QAExB;;;;WAIG;QACH,WAAM,GAAW,aAAa,CAAC;QAO/B;;WAEG;QACH,gBAAW,GAAsB,EAAE,CAAC;QAEpC;;;WAGG;QACH,eAAU,GAAkB,EAAE,CAAC;QAE/B;;;WAGG;QACH,gBAAW,GAAgB;YACzB,iBAAiB,EAAE,KAAK;SACzB,CAAA;IAQD,CAAC;CAEF;AAjED,4BAiEC"}
1
+ {"version":3,"file":"log.model.js","sourceRoot":"","sources":["../../../../src/models/log.model.ts"],"names":[],"mappings":";;;AAIA;;;;;;GAMG;AACH,MAAa,QAAQ;IAgDnB;;;;OAIG;IACH,YAAmB,QAAsB,EAAS,OAAe;QAA9C,aAAQ,GAAR,QAAQ,CAAc;QAAS,YAAO,GAAP,OAAO,CAAQ;QAhCjE;;WAEG;QACH,SAAI,GAAS,IAAI,IAAI,EAAE,CAAC;QAExB;;;WAGG;QACH,WAAM,GAAW,aAAa,CAAC;QAO/B;;;WAGG;QACH,eAAU,GAAkB,EAAE,CAAC;QAE/B;;WAEG;QACH,gBAAW,GAAgB,EAAE,CAAC;IAQ9B,CAAC;CAEF;AAxDD,4BAwDC"}
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./breadcrumb.model"), exports);
18
17
  __exportStar(require("./diagnostics.model"), exports);
19
18
  __exportStar(require("./log.model"), exports);
20
19
  //# sourceMappingURL=models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,8CAA4B"}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,8CAA4B"}