@fabasoad/sarif-to-slack 1.3.4 → 1.4.0

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 (148) hide show
  1. package/.github/workflows/release.yml +1 -1
  2. package/.github/workflows/security.yml +1 -0
  3. package/.github/workflows/send-sarif-to-slack.yml +39 -15
  4. package/.pre-commit-config.yaml +4 -4
  5. package/.tool-versions +1 -1
  6. package/Makefile +1 -1
  7. package/README.md +8 -7
  8. package/api-extractor.json +2 -2
  9. package/dist/Logger.js +40 -30
  10. package/dist/SarifToSlackClient.d.ts +0 -1
  11. package/dist/SarifToSlackClient.d.ts.map +1 -1
  12. package/dist/SarifToSlackClient.js +11 -8
  13. package/dist/globalState.d.ts +2 -0
  14. package/dist/globalState.d.ts.map +1 -0
  15. package/dist/globalState.js +2 -0
  16. package/dist/index.cjs +118 -81
  17. package/dist/index.d.ts +529 -6
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +9 -2
  20. package/dist/model/Finding.js +7 -5
  21. package/dist/model/FindingArray.js +1 -1
  22. package/dist/model/SendIf.js +1 -1
  23. package/dist/model/SlackMessage.js +6 -6
  24. package/dist/model/color/Color.d.ts.map +1 -1
  25. package/dist/model/color/Color.js +1 -1
  26. package/dist/model/color/ColorIdentification.js +5 -5
  27. package/dist/model/color/ColorOptions.d.ts.map +1 -1
  28. package/dist/processors/CodeQLProcessor.js +1 -1
  29. package/dist/processors/CommonProcessor.js +1 -1
  30. package/dist/processors/ProcessorFactory.js +1 -1
  31. package/dist/processors/SnykProcessor.js +2 -1
  32. package/dist/representations/CompactGroupByRepresentation.js +1 -1
  33. package/dist/representations/CompactGroupByRunPerLevelRepresentation.js +1 -1
  34. package/dist/representations/CompactGroupByRunPerSeverityRepresentation.js +1 -1
  35. package/dist/representations/CompactGroupByRunRepresentation.js +1 -1
  36. package/dist/representations/CompactGroupBySarifPerLevelRepresentation.js +1 -1
  37. package/dist/representations/CompactGroupBySarifPerSeverityRepresentation.js +1 -1
  38. package/dist/representations/CompactGroupBySarifRepresentation.js +1 -1
  39. package/dist/representations/CompactGroupByToolNamePerLevelRepresentation.js +1 -1
  40. package/dist/representations/CompactGroupByToolNamePerSeverityRepresentation.js +1 -1
  41. package/dist/representations/CompactGroupByToolNameRepresentation.js +1 -1
  42. package/dist/representations/CompactTotalPerLevelRepresentation.js +1 -1
  43. package/dist/representations/CompactTotalPerSeverityRepresentation.js +1 -1
  44. package/dist/representations/CompactTotalRepresentation.js +1 -1
  45. package/dist/representations/Representation.js +1 -1
  46. package/dist/representations/RepresentationFactory.js +1 -1
  47. package/dist/representations/TableGroupByRunPerLevelRepresentation.d.ts.map +1 -1
  48. package/dist/representations/TableGroupByRunPerLevelRepresentation.js +1 -1
  49. package/dist/representations/TableGroupByRunPerSeverityRepresentation.d.ts.map +1 -1
  50. package/dist/representations/TableGroupByRunPerSeverityRepresentation.js +1 -1
  51. package/dist/representations/TableGroupByRunRepresentation.d.ts.map +1 -1
  52. package/dist/representations/TableGroupByRunRepresentation.js +1 -1
  53. package/dist/representations/TableGroupBySarifPerLevelRepresentation.d.ts.map +1 -1
  54. package/dist/representations/TableGroupBySarifPerLevelRepresentation.js +1 -1
  55. package/dist/representations/TableGroupBySarifPerSeverityRepresentation.d.ts.map +1 -1
  56. package/dist/representations/TableGroupBySarifPerSeverityRepresentation.js +1 -1
  57. package/dist/representations/TableGroupBySarifRepresentation.d.ts.map +1 -1
  58. package/dist/representations/TableGroupBySarifRepresentation.js +1 -1
  59. package/dist/representations/TableGroupByToolNamePerLevelRepresentation.d.ts.map +1 -1
  60. package/dist/representations/TableGroupByToolNamePerLevelRepresentation.js +1 -1
  61. package/dist/representations/TableGroupByToolNamePerSeverityRepresentation.d.ts.map +1 -1
  62. package/dist/representations/TableGroupByToolNamePerSeverityRepresentation.js +1 -1
  63. package/dist/representations/TableGroupByToolNameRepresentation.d.ts.map +1 -1
  64. package/dist/representations/TableGroupByToolNameRepresentation.js +1 -1
  65. package/dist/representations/TableGroupRepresentation.d.ts +0 -1
  66. package/dist/representations/TableGroupRepresentation.d.ts.map +1 -1
  67. package/dist/representations/TableGroupRepresentation.js +3 -3
  68. package/dist/representations/table/Cell.d.ts.map +1 -1
  69. package/dist/representations/table/Cell.js +1 -1
  70. package/dist/representations/table/Column.d.ts +0 -1
  71. package/dist/representations/table/Column.d.ts.map +1 -1
  72. package/dist/representations/table/Column.js +4 -3
  73. package/dist/representations/table/Row.d.ts +0 -1
  74. package/dist/representations/table/Row.d.ts.map +1 -1
  75. package/dist/representations/table/Row.js +3 -3
  76. package/dist/representations/table/Table.d.ts.map +1 -1
  77. package/dist/representations/table/Table.js +1 -1
  78. package/dist/system.js +5 -5
  79. package/dist/tsdoc-metadata.json +1 -1
  80. package/dist/types.d.ts +29 -1
  81. package/dist/types.d.ts.map +1 -1
  82. package/dist/types.js +11 -1
  83. package/dist/utils/Comparators.js +1 -1
  84. package/dist/utils/ExtendedArray.js +1 -1
  85. package/dist/utils/FileUtils.js +2 -2
  86. package/dist/utils/SarifUtils.js +1 -1
  87. package/dist/utils/StringUtils.js +1 -1
  88. package/etc/sarif-to-slack.api.md +21 -1
  89. package/jest.config.json +4 -4
  90. package/package.json +10 -9
  91. package/src/Logger.ts +50 -34
  92. package/src/SarifToSlackClient.ts +73 -68
  93. package/src/globalState.ts +11 -0
  94. package/src/index.ts +23 -12
  95. package/src/model/Finding.ts +36 -35
  96. package/src/model/FindingArray.ts +5 -5
  97. package/src/model/SendIf.ts +25 -25
  98. package/src/model/SlackMessage.ts +49 -49
  99. package/src/model/color/Color.ts +7 -7
  100. package/src/model/color/ColorIdentification.ts +77 -77
  101. package/src/model/color/ColorOptions.ts +1 -1
  102. package/src/processors/CodeQLProcessor.ts +3 -3
  103. package/src/processors/CommonProcessor.ts +24 -24
  104. package/src/processors/ProcessorFactory.ts +9 -9
  105. package/src/processors/SnykProcessor.ts +3 -2
  106. package/src/representations/CompactGroupByRepresentation.ts +20 -20
  107. package/src/representations/CompactGroupByRunPerLevelRepresentation.ts +2 -2
  108. package/src/representations/CompactGroupByRunPerSeverityRepresentation.ts +2 -2
  109. package/src/representations/CompactGroupByRunRepresentation.ts +10 -10
  110. package/src/representations/CompactGroupBySarifPerLevelRepresentation.ts +2 -2
  111. package/src/representations/CompactGroupBySarifPerSeverityRepresentation.ts +2 -2
  112. package/src/representations/CompactGroupBySarifRepresentation.ts +11 -11
  113. package/src/representations/CompactGroupByToolNamePerLevelRepresentation.ts +2 -2
  114. package/src/representations/CompactGroupByToolNamePerSeverityRepresentation.ts +2 -2
  115. package/src/representations/CompactGroupByToolNameRepresentation.ts +10 -10
  116. package/src/representations/CompactTotalPerLevelRepresentation.ts +2 -2
  117. package/src/representations/CompactTotalPerSeverityRepresentation.ts +2 -2
  118. package/src/representations/CompactTotalRepresentation.ts +5 -5
  119. package/src/representations/Representation.ts +8 -8
  120. package/src/representations/RepresentationFactory.ts +32 -32
  121. package/src/representations/TableGroupByRunPerLevelRepresentation.ts +3 -3
  122. package/src/representations/TableGroupByRunPerSeverityRepresentation.ts +3 -3
  123. package/src/representations/TableGroupByRunRepresentation.ts +5 -5
  124. package/src/representations/TableGroupBySarifPerLevelRepresentation.ts +3 -3
  125. package/src/representations/TableGroupBySarifPerSeverityRepresentation.ts +3 -3
  126. package/src/representations/TableGroupBySarifRepresentation.ts +9 -9
  127. package/src/representations/TableGroupByToolNamePerLevelRepresentation.ts +3 -3
  128. package/src/representations/TableGroupByToolNamePerSeverityRepresentation.ts +3 -3
  129. package/src/representations/TableGroupByToolNameRepresentation.ts +4 -4
  130. package/src/representations/TableGroupRepresentation.ts +32 -32
  131. package/src/representations/table/Cell.ts +8 -8
  132. package/src/representations/table/Column.ts +13 -13
  133. package/src/representations/table/Row.ts +17 -17
  134. package/src/representations/table/Table.ts +21 -21
  135. package/src/system.ts +5 -5
  136. package/src/types.ts +43 -13
  137. package/src/utils/Comparators.ts +6 -6
  138. package/src/utils/ExtendedArray.ts +1 -1
  139. package/src/utils/FileUtils.ts +3 -3
  140. package/src/utils/SarifUtils.ts +6 -6
  141. package/src/utils/StringUtils.ts +3 -3
  142. package/tests/integration/SendSarifToSlack.spec.ts +73 -67
  143. package/tests/representations/CompactGroupByRunPerLevelRepresentation.spec.ts +121 -0
  144. package/tests/representations/CompactGroupByRunPerSeverityRepresentation.spec.ts +122 -0
  145. package/tests/representations/CompactGroupBySarifPerLevelRepresentation.spec.ts +132 -0
  146. package/tests/representations/CompactGroupBySarifPerSeverityRepresentation.spec.ts +133 -0
  147. package/tsconfig.json +3 -4
  148. package/dist/sarif-to-slack.d.ts +0 -562
package/dist/index.cjs CHANGED
@@ -32,7 +32,9 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  Color: () => Color,
34
34
  FooterType: () => FooterType,
35
+ LogLevelItems: () => LogLevelItems,
35
36
  RepresentationType: () => RepresentationType,
37
+ SarifFileExtensionItems: () => SarifFileExtensionItems,
36
38
  SarifToSlackClient: () => SarifToSlackClient,
37
39
  SendIf: () => SendIf
38
40
  });
@@ -168,23 +170,24 @@ function sendIfLogMessage(sendIf) {
168
170
  var import_node_fs2 = require("fs");
169
171
 
170
172
  // src/Logger.ts
171
- var import_tslog = require("tslog");
172
173
  var import_zod2 = require("zod");
174
+ var stackTraceParser = __toESM(require("stacktrace-parser"));
175
+ var import_tslog = require("tslog");
173
176
 
174
177
  // src/system.ts
175
178
  var import_zod = require("zod");
176
179
 
177
180
  // src/metadata.json
178
- var version = "1.3.4";
179
- var sha = "7dcec52f94545c8b5319ca92f2e77130b7bd0f3a";
180
- var buildAt = "2026-02-13T14:07:20Z";
181
+ var version = "1.4.0";
182
+ var sha = "3b7ca554e41d0d7c94a7eeae079f3afc1d384c4d";
183
+ var buildAt = "2026-04-12T13:12:12Z";
181
184
 
182
185
  // src/system.ts
183
186
  function logMetadata() {
184
- const logger = new Logger(logMetadata.name);
185
- logger.info(`version: ${version}`);
186
- logger.info(`sha: ${sha}`);
187
- logger.info(`built at: ${buildAt}`);
187
+ const logger = new Logger();
188
+ logger.debug(`version: ${version}`);
189
+ logger.debug(`sha: ${sha}`);
190
+ logger.debug(`built at: ${buildAt}`);
188
191
  }
189
192
  function isDebug() {
190
193
  const parseResult = import_zod.z.stringbool().safeParse(
@@ -193,61 +196,6 @@ function isDebug() {
193
196
  return parseResult.success && parseResult.data;
194
197
  }
195
198
 
196
- // src/Logger.ts
197
- var LogLevelItems = ["silly", "trace", "debug", "info", "warning", "error", "fatal"];
198
- var Logger = class _Logger {
199
- static APP_NAME = "@fabasoad/sarif-to-slack";
200
- static DEFAULT_LOG_LEVEL = "info";
201
- static DEFAULT_LOG_TEMPLATE = "[{{logLevelName}}] [{{name}}] {{dateIsoStr}} ";
202
- static DEFAULT_LOG_COLORED = true;
203
- _instance;
204
- isLogLevel(v) {
205
- return LogLevelItems.includes(v);
206
- }
207
- getMinLevel() {
208
- let result = _Logger.DEFAULT_LOG_LEVEL;
209
- if (isDebug()) {
210
- result = "silly";
211
- } else {
212
- const parseResult = import_zod2.z.string().refine((v) => this.isLogLevel(v)).transform((v) => v).safeParse(process.env.SARIF_TO_SLACK_LOG_LEVEL);
213
- if (parseResult.success) {
214
- result = parseResult.data;
215
- }
216
- }
217
- return LogLevelItems.findIndex((v) => v === result);
218
- }
219
- getLogTemplate() {
220
- const result = import_zod2.z.string().safeParse(process.env.SARIF_TO_SLACK_LOG_TEMPLATE);
221
- return result.success ? result.data : _Logger.DEFAULT_LOG_TEMPLATE;
222
- }
223
- getLogColored() {
224
- const result = import_zod2.z.stringbool().safeParse(process.env.SARIF_TO_SLACK_LOG_COLORED);
225
- return result.success ? result.data : _Logger.DEFAULT_LOG_COLORED;
226
- }
227
- constructor(memberName) {
228
- this._instance = new import_tslog.Logger({
229
- name: `${_Logger.APP_NAME}${memberName === void 0 ? "" : `::${memberName}`}`,
230
- minLevel: this.getMinLevel(),
231
- type: "pretty",
232
- prettyLogTimeZone: "UTC",
233
- prettyLogTemplate: this.getLogTemplate(),
234
- stylePrettyLogs: this.getLogColored()
235
- });
236
- }
237
- info(...args) {
238
- this._instance.info(...args);
239
- }
240
- warn(...args) {
241
- this._instance.warn(...args);
242
- }
243
- trace(...args) {
244
- this._instance.trace(...args);
245
- }
246
- debug(...args) {
247
- this._instance.debug(...args);
248
- }
249
- };
250
-
251
199
  // src/types.ts
252
200
  var FooterType = /* @__PURE__ */ ((FooterType2) => {
253
201
  FooterType2["PlainText"] = "plain_text";
@@ -271,6 +219,8 @@ var RepresentationType = /* @__PURE__ */ ((RepresentationType2) => {
271
219
  RepresentationType2[RepresentationType2["TableGroupBySarifPerSeverity"] = 13] = "TableGroupBySarifPerSeverity";
272
220
  return RepresentationType2;
273
221
  })(RepresentationType || {});
222
+ var SarifFileExtensionItems = ["sarif", "json"];
223
+ var LogLevelItems = ["silly", "trace", "debug", "info", "warning", "error", "fatal"];
274
224
  var SecuritySeverity = /* @__PURE__ */ ((SecuritySeverity2) => {
275
225
  SecuritySeverity2[SecuritySeverity2["Unknown"] = 0] = "Unknown";
276
226
  SecuritySeverity2[SecuritySeverity2["None"] = 1] = "None";
@@ -295,6 +245,78 @@ var SecurityLevelValues = Object.values(SecurityLevel).filter(
295
245
  (v) => typeof v === "string"
296
246
  );
297
247
 
248
+ // src/globalState.ts
249
+ var globalState = {};
250
+
251
+ // src/Logger.ts
252
+ var Logger = class _Logger {
253
+ static DEFAULT_LOG_LEVEL = "info";
254
+ static DEFAULT_FUNC_NAME_POSITION = 2;
255
+ _instance;
256
+ getMinLevel(minLevel) {
257
+ let result = _Logger.DEFAULT_LOG_LEVEL;
258
+ if (isDebug()) {
259
+ result = "silly";
260
+ } else if (minLevel !== void 0) {
261
+ const parseResult = import_zod2.z.enum(LogLevelItems).safeParse(minLevel);
262
+ if (parseResult.success) {
263
+ result = parseResult.data;
264
+ }
265
+ }
266
+ return LogLevelItems.findIndex((v) => v === result);
267
+ }
268
+ composeLogHeader(name, logFunctionName, logFunctionNameOnPosition) {
269
+ let result = name;
270
+ if (logFunctionName === true) {
271
+ const pos = logFunctionNameOnPosition ?? _Logger.DEFAULT_FUNC_NAME_POSITION;
272
+ if (result === void 0) {
273
+ result = "";
274
+ } else {
275
+ result += "::";
276
+ }
277
+ const stackFrames = stackTraceParser.parse(
278
+ new Error().stack ?? ""
279
+ );
280
+ if (stackFrames.length > pos) {
281
+ result += stackFrames[pos].methodName;
282
+ }
283
+ }
284
+ return result;
285
+ }
286
+ constructor(overrides = {}) {
287
+ const opts = {
288
+ ...structuredClone(globalState.loggerOpts ?? {}),
289
+ ...overrides
290
+ };
291
+ const logName = this.composeLogHeader(
292
+ opts.name,
293
+ opts.logFunctionName,
294
+ opts.logFunctionNameOnPosition
295
+ );
296
+ const settings = {
297
+ minLevel: this.getMinLevel(opts.minLevel),
298
+ name: logName,
299
+ type: "pretty",
300
+ prettyLogTemplate: opts.prettyLogTemplate || (logName === void 0 ? "[{{logLevelName}}] {{dateIsoStr}} " : "[{{logLevelName}}] [{{name}}] {{dateIsoStr}} "),
301
+ prettyLogTimeZone: "UTC",
302
+ stylePrettyLogs: opts.stylePrettyLogs ?? true
303
+ };
304
+ this._instance = new import_tslog.Logger(settings);
305
+ }
306
+ info(...args) {
307
+ this._instance.info(...args);
308
+ }
309
+ warn(...args) {
310
+ this._instance.warn(...args);
311
+ }
312
+ trace(...args) {
313
+ this._instance.trace(...args);
314
+ }
315
+ debug(...args) {
316
+ this._instance.debug(...args);
317
+ }
318
+ };
319
+
298
320
  // src/utils/FileUtils.ts
299
321
  var import_node_fs = __toESM(require("fs"));
300
322
  var path = __toESM(require("path"));
@@ -313,10 +335,10 @@ function listFiles(dir, recursive, extension, fileList = []) {
313
335
  return fileList;
314
336
  }
315
337
  function extractListOfFiles(opts) {
316
- const logger = new Logger(extractListOfFiles.name);
317
338
  if (!import_node_fs.default.existsSync(opts.path)) {
318
339
  throw new Error(`Provided path does not exist: ${opts.path}`);
319
340
  }
341
+ const logger = new Logger();
320
342
  const stats = import_node_fs.default.statSync(opts.path);
321
343
  if (stats.isDirectory()) {
322
344
  logger.info(`Provided path is a directory: ${opts.path}`);
@@ -565,7 +587,7 @@ var Column = class {
565
587
  this.header = header;
566
588
  this._cells = new Array(cellsCount);
567
589
  }
568
- _logger = new Logger("Column");
590
+ header;
569
591
  _cells;
570
592
  get total() {
571
593
  return this._cells.reduce((sum, c) => {
@@ -585,7 +607,9 @@ var Column = class {
585
607
  const width = this.width;
586
608
  this._cells.forEach((c) => c.setWidth(width));
587
609
  } else {
588
- this._logger.warn(`Cell index out of range. Requested index: ${index}. Cells count: ${this._cells.length}.`);
610
+ const logger = new Logger();
611
+ ;
612
+ logger.warn(`Cell index out of range. Requested index: ${index}. Cells count: ${this._cells.length}.`);
589
613
  }
590
614
  }
591
615
  };
@@ -596,6 +620,7 @@ var Cell = class {
596
620
  this._value = _value;
597
621
  this._width = _value.toString().length;
598
622
  }
623
+ _value;
599
624
  _width;
600
625
  setWidth(width) {
601
626
  this._width = width > this._width ? width : this._width;
@@ -621,7 +646,8 @@ var Row = class {
621
646
  this._cells = Array.from({ length: cellsCount }, () => new Cell());
622
647
  this._totalWidth = 1;
623
648
  }
624
- _logger = new Logger("Row");
649
+ _header;
650
+ headerWidth;
625
651
  _cells;
626
652
  _totalWidth;
627
653
  get total() {
@@ -634,7 +660,8 @@ var Row = class {
634
660
  if (index >= 0 && index < this._cells.length) {
635
661
  this._cells[index] = value;
636
662
  } else {
637
- this._logger.warn(`Setting cell failed. Reason: index out of range. Requested index: ${index}. Cells count: ${this._cells.length}.`);
663
+ const logger = new Logger();
664
+ logger.warn(`Setting cell failed. Reason: index out of range. Requested index: ${index}. Cells count: ${this._cells.length}.`);
638
665
  }
639
666
  }
640
667
  get totalWidth() {
@@ -729,7 +756,9 @@ var TableGroupRepresentation = class extends Representation {
729
756
  this._keyPer = _keyPer;
730
757
  this._values = _values;
731
758
  }
732
- _logger = new Logger("TableGroupRepresentation");
759
+ _keyBy;
760
+ _keyPer;
761
+ _values;
733
762
  groupFindingsPer(findings) {
734
763
  return findings.reduce(
735
764
  (grouped, f) => {
@@ -768,6 +797,7 @@ var TableGroupRepresentation = class extends Representation {
768
797
  }
769
798
  }
770
799
  compose() {
800
+ const logger = new Logger();
771
801
  const groupedBy = this.groupFindingsBy(this._model.findings);
772
802
  const table = new Table({
773
803
  main: this.title,
@@ -783,7 +813,7 @@ var TableGroupRepresentation = class extends Representation {
783
813
  i++;
784
814
  }
785
815
  const result = this.codeBlock(table.toString());
786
- this._logger.trace(result);
816
+ logger.trace(result);
787
817
  return result;
788
818
  }
789
819
  };
@@ -991,6 +1021,7 @@ var SnykProcessor = class extends CommonProcessor {
991
1021
  * property where CVSS score is also defined. This method tries to get level
992
1022
  * from this "cvssv3_baseScore" property and if it fails to do so, then it tries
993
1023
  * to get CVSS score in a common way.
1024
+ * @internal
994
1025
  */
995
1026
  tryFindCvssScore() {
996
1027
  return this.tryFindRuleProperty("cvssv3_baseScore") ?? super.tryFindCvssScore();
@@ -1028,7 +1059,6 @@ function createFinding(opts) {
1028
1059
  return new FindingImpl(opts);
1029
1060
  }
1030
1061
  var FindingImpl = class {
1031
- _logger = new Logger("FindingImpl");
1032
1062
  _runMetadata;
1033
1063
  _result;
1034
1064
  _sarifPath;
@@ -1074,7 +1104,9 @@ var FindingImpl = class {
1074
1104
  this._levelCache = this._processor.tryFindLevel();
1075
1105
  }
1076
1106
  if (this._levelCache === void 0) {
1077
- this._logger.debug(`Unknown level of ${this._rule?.id} rule`);
1107
+ const logger = new Logger();
1108
+ ;
1109
+ logger.debug(`Unknown level of ${this._rule?.id} rule`);
1078
1110
  return 0 /* Unknown */;
1079
1111
  }
1080
1112
  switch (this._levelCache) {
@@ -1090,7 +1122,8 @@ var FindingImpl = class {
1090
1122
  }
1091
1123
  get severity() {
1092
1124
  if (this.cvssScore == null || this.cvssScore < 0 || this.cvssScore > 10) {
1093
- this._logger.debug(`Unsupported CVSS score ${this.cvssScore} in ${this._rule?.id} rule`);
1125
+ const logger = new Logger();
1126
+ logger.debug(`Unsupported CVSS score ${this.cvssScore} in ${this._rule?.id} rule`);
1094
1127
  return 0 /* Unknown */;
1095
1128
  }
1096
1129
  if (this.cvssScore >= 9) {
@@ -1122,7 +1155,7 @@ function logPropIsNotDefined(logger, key, val) {
1122
1155
  logger.trace(`'${prop}.${val}' property is not defined. Continue color identification...`);
1123
1156
  }
1124
1157
  function identifyColorCommon(findings, prop, none, unknown, color) {
1125
- const logger = new Logger(identifyColorCommon.name);
1158
+ const logger = new Logger();
1126
1159
  if (color.none) {
1127
1160
  if (findings.findByProperty(prop, none) != null) {
1128
1161
  logColorTaken(logger, color.none, `${prop === "severity" ? "bySeverity" : "byLevel"}.none`);
@@ -1146,7 +1179,7 @@ function identifyColorCommon(findings, prop, none, unknown, color) {
1146
1179
  return void 0;
1147
1180
  }
1148
1181
  function identifyColorBySeverity(findings, color) {
1149
- const logger = new Logger(identifyColorBySeverity.name);
1182
+ const logger = new Logger();
1150
1183
  if (color.critical) {
1151
1184
  if (findings.findByProperty("severity", 5 /* Critical */) != null) {
1152
1185
  logColorTaken(logger, color.critical, "bySeverity.critical");
@@ -1190,7 +1223,7 @@ function identifyColorBySeverity(findings, color) {
1190
1223
  return identifyColorCommon(findings, "severity", 1 /* None */, 0 /* Unknown */, color);
1191
1224
  }
1192
1225
  function identifyColorByLevel(findings, color) {
1193
- const logger = new Logger(identifyColorByLevel.name);
1226
+ const logger = new Logger();
1194
1227
  if (color.error) {
1195
1228
  if (findings.findByProperty("level", 4 /* Error */) != null) {
1196
1229
  logColorTaken(logger, color.error, "byLevel.error");
@@ -1224,7 +1257,7 @@ function identifyColorByLevel(findings, color) {
1224
1257
  return identifyColorCommon(findings, "level", 1 /* None */, 0 /* Unknown */, color);
1225
1258
  }
1226
1259
  function identifyColor(findings, colorOpts) {
1227
- const logger = new Logger(identifyColor.name);
1260
+ const logger = new Logger();
1228
1261
  if (!colorOpts) {
1229
1262
  logger.debug("Message has no color as color options are not defined.");
1230
1263
  return void 0;
@@ -1355,7 +1388,6 @@ var SlackMessageImpl = class {
1355
1388
 
1356
1389
  // src/SarifToSlackClient.ts
1357
1390
  var SarifToSlackClient = class _SarifToSlackClient {
1358
- _logger = new Logger("SarifToSlackClient");
1359
1391
  _message;
1360
1392
  _sarifModel;
1361
1393
  _sendIf = 20 /* Always */;
@@ -1379,8 +1411,10 @@ var SarifToSlackClient = class _SarifToSlackClient {
1379
1411
  * @public
1380
1412
  */
1381
1413
  static async create(webhookUrl, opts) {
1414
+ globalState.loggerOpts = opts.loggerOptions;
1415
+ const logger = new Logger();
1416
+ logger.trace(opts);
1382
1417
  const instance = new _SarifToSlackClient();
1383
- instance._logger.trace(opts);
1384
1418
  instance._sendIf = opts.sendIf ?? instance._sendIf;
1385
1419
  instance._sarifModel = await _SarifToSlackClient.buildModel(opts.sarif);
1386
1420
  instance._message = await _SarifToSlackClient.initialize(webhookUrl, opts, instance._sarifModel);
@@ -1458,14 +1492,15 @@ var SarifToSlackClient = class _SarifToSlackClient {
1458
1492
  if (this._sarifModel == null) {
1459
1493
  throw new Error("Could not parse SARIF file(s).");
1460
1494
  }
1495
+ const logger = new Logger();
1461
1496
  if (this.shouldSendMessage) {
1462
1497
  if (this._message == null) {
1463
1498
  throw new Error("Slack message was not prepared.");
1464
1499
  }
1465
1500
  const text = await this._message.send();
1466
- this._logger.info("Message sent. Status:", text);
1501
+ logger.info("Message sent. Status:", text);
1467
1502
  } else {
1468
- this._logger.info(sendIfLogMessage(this._sendIf));
1503
+ logger.info(sendIfLogMessage(this._sendIf));
1469
1504
  }
1470
1505
  }
1471
1506
  get shouldSendMessage() {
@@ -1530,7 +1565,9 @@ var SarifToSlackClient = class _SarifToSlackClient {
1530
1565
  0 && (module.exports = {
1531
1566
  Color,
1532
1567
  FooterType,
1568
+ LogLevelItems,
1533
1569
  RepresentationType,
1570
+ SarifFileExtensionItems,
1534
1571
  SarifToSlackClient,
1535
1572
  SendIf
1536
1573
  });