@datadog/datadog-ci-plugin-terraform 5.18.0 → 5.19.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.
package/dist/bundle.js CHANGED
@@ -10914,11 +10914,12 @@ var require_glob = /* @__PURE__ */ __commonJSMin(((exports) => {
10914
10914
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10915
10915
  module.exports = {
10916
10916
  "name": "@datadog/datadog-ci-base",
10917
- "version": "5.18.0",
10917
+ "version": "5.19.0",
10918
10918
  "description": "Base package for Datadog CI",
10919
10919
  "license": "Apache-2.0",
10920
10920
  "keywords": ["datadog", "datadog-ci"],
10921
10921
  "homepage": "https://github.com/DataDog/datadog-ci/tree/master/packages/base",
10922
+ "bugs": { "url": "https://github.com/DataDog/datadog-ci/issues" },
10922
10923
  "repository": {
10923
10924
  "type": "git",
10924
10925
  "url": "https://github.com/DataDog/datadog-ci.git",
@@ -76271,12 +76272,19 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
76271
76272
  LogLevel[LogLevel["WARN"] = 3] = "WARN";
76272
76273
  LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
76273
76274
  })(LogLevel || (exports.LogLevel = LogLevel = {}));
76275
+ const LEVEL_NAMES = {
76276
+ [LogLevel.DEBUG]: "debug",
76277
+ [LogLevel.INFO]: "info",
76278
+ [LogLevel.WARN]: "warn",
76279
+ [LogLevel.ERROR]: "error"
76280
+ };
76274
76281
  var Logger = class {
76275
- constructor(writeMessage, loglevel, shouldIncludeTimestamp) {
76276
- this.shouldIncludeTimestamp = shouldIncludeTimestamp !== null && shouldIncludeTimestamp !== void 0 ? shouldIncludeTimestamp : false;
76277
- this.writeMessage = (s) => {
76278
- return writeMessage(this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ${s}` : s);
76279
- };
76282
+ constructor(writeMessage, loglevel, shouldIncludeTimestampOrOptions) {
76283
+ var _a, _b;
76284
+ const options = typeof shouldIncludeTimestampOrOptions === "boolean" ? { shouldIncludeTimestamp: shouldIncludeTimestampOrOptions } : shouldIncludeTimestampOrOptions !== null && shouldIncludeTimestampOrOptions !== void 0 ? shouldIncludeTimestampOrOptions : {};
76285
+ this.rawWriteMessage = writeMessage;
76286
+ this.shouldIncludeTimestamp = (_a = options.shouldIncludeTimestamp) !== null && _a !== void 0 ? _a : false;
76287
+ this.jsonOutput = (_b = options.jsonOutput) !== null && _b !== void 0 ? _b : false;
76280
76288
  this.loglevel = loglevel;
76281
76289
  }
76282
76290
  setLogLevel(newLogLevel) {
@@ -76285,17 +76293,34 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
76285
76293
  setShouldIncludeTime(newShouldIncludeTimestamp) {
76286
76294
  this.shouldIncludeTimestamp = newShouldIncludeTimestamp;
76287
76295
  }
76296
+ setJsonOutput(newJsonOutput) {
76297
+ this.jsonOutput = newJsonOutput;
76298
+ }
76288
76299
  error(s) {
76289
- if (this.loglevel <= LogLevel.ERROR) this.writeMessage(chalk_1.default.red(s) + "\n");
76300
+ if (this.loglevel <= LogLevel.ERROR) this.emit(LogLevel.ERROR, s, chalk_1.default.red);
76290
76301
  }
76291
76302
  warn(s) {
76292
- if (this.loglevel <= LogLevel.WARN) this.writeMessage(chalk_1.default.yellow(s) + "\n");
76303
+ if (this.loglevel <= LogLevel.WARN) this.emit(LogLevel.WARN, s, chalk_1.default.yellow);
76293
76304
  }
76294
76305
  info(s) {
76295
- if (this.loglevel <= LogLevel.INFO) this.writeMessage(s + "\n");
76306
+ if (this.loglevel <= LogLevel.INFO) this.emit(LogLevel.INFO, s);
76296
76307
  }
76297
76308
  debug(s) {
76298
- if (this.loglevel <= LogLevel.DEBUG) this.writeMessage(s + "\n");
76309
+ if (this.loglevel <= LogLevel.DEBUG) this.emit(LogLevel.DEBUG, s);
76310
+ }
76311
+ emit(level, message, colorize) {
76312
+ if (this.jsonOutput) {
76313
+ const payload = {
76314
+ level: LEVEL_NAMES[level],
76315
+ message
76316
+ };
76317
+ if (this.shouldIncludeTimestamp) payload.timestamp = (/* @__PURE__ */ new Date()).toISOString();
76318
+ this.rawWriteMessage(JSON.stringify(payload) + "\n");
76319
+ return;
76320
+ }
76321
+ const prefix = this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ` : "";
76322
+ const body = colorize ? colorize(message) : message;
76323
+ this.rawWriteMessage(prefix + body + "\n");
76299
76324
  }
76300
76325
  };
76301
76326
  exports.Logger = Logger;