@skmtc/core 0.47.2 → 0.47.3

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.
@@ -514,14 +514,31 @@ export class ParseContext {
514
514
  logIssueAt(issue, parent) {
515
515
  const added = __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_addIssue).call(this, toParseIssue(issue));
516
516
  if (added && !this.silent) {
517
- this.logger.warn({
517
+ const payload = {
518
518
  protocol: issue.protocol,
519
519
  level: issue.level,
520
520
  location: issue.location,
521
521
  message: issue.message,
522
522
  type: issue.type,
523
523
  ...(parent === undefined ? {} : { parent: JSON.stringify(parent) })
524
- });
524
+ };
525
+ // Each issue is logged at its own level, so a log threshold above
526
+ // DEBUG leaves `debug` issues out.
527
+ switch (issue.level) {
528
+ case 'error':
529
+ this.logger.error(payload);
530
+ break;
531
+ case 'warning':
532
+ this.logger.warn(payload);
533
+ break;
534
+ case 'debug':
535
+ this.logger.debug(payload);
536
+ break;
537
+ default: {
538
+ const _exhaustive = issue;
539
+ throw new Error(`Unhandled issue level: ${JSON.stringify(_exhaustive)}`);
540
+ }
541
+ }
525
542
  }
526
543
  }
527
544
  // -- OAS-flavored surface (StackTrail-based) ---------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.47.2",
3
+ "version": "0.47.3",
4
4
  "description": "Skmtc is a declarative code generation framework",
5
5
  "keywords": [
6
6
  "openapi",
@@ -517,14 +517,31 @@ class ParseContext {
517
517
  logIssueAt(issue, parent) {
518
518
  const added = __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_addIssue).call(this, toParseIssue(issue));
519
519
  if (added && !this.silent) {
520
- this.logger.warn({
520
+ const payload = {
521
521
  protocol: issue.protocol,
522
522
  level: issue.level,
523
523
  location: issue.location,
524
524
  message: issue.message,
525
525
  type: issue.type,
526
526
  ...(parent === undefined ? {} : { parent: JSON.stringify(parent) })
527
- });
527
+ };
528
+ // Each issue is logged at its own level, so a log threshold above
529
+ // DEBUG leaves `debug` issues out.
530
+ switch (issue.level) {
531
+ case 'error':
532
+ this.logger.error(payload);
533
+ break;
534
+ case 'warning':
535
+ this.logger.warn(payload);
536
+ break;
537
+ case 'debug':
538
+ this.logger.debug(payload);
539
+ break;
540
+ default: {
541
+ const _exhaustive = issue;
542
+ throw new Error(`Unhandled issue level: ${JSON.stringify(_exhaustive)}`);
543
+ }
544
+ }
528
545
  }
529
546
  }
530
547
  // -- OAS-flavored surface (StackTrail-based) ---------------------