@datadog/datadog-ci-plugin-container-app 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
@@ -53125,11 +53125,12 @@ var require_source$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53125
53125
  var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53126
53126
  module.exports = {
53127
53127
  "name": "@datadog/datadog-ci-base",
53128
- "version": "5.18.0",
53128
+ "version": "5.19.0",
53129
53129
  "description": "Base package for Datadog CI",
53130
53130
  "license": "Apache-2.0",
53131
53131
  "keywords": ["datadog", "datadog-ci"],
53132
53132
  "homepage": "https://github.com/DataDog/datadog-ci/tree/master/packages/base",
53133
+ "bugs": { "url": "https://github.com/DataDog/datadog-ci/issues" },
53133
53134
  "repository": {
53134
53135
  "type": "git",
53135
53136
  "url": "https://github.com/DataDog/datadog-ci.git",
@@ -116857,12 +116858,19 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
116857
116858
  LogLevel[LogLevel["WARN"] = 3] = "WARN";
116858
116859
  LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
116859
116860
  })(LogLevel || (exports.LogLevel = LogLevel = {}));
116861
+ const LEVEL_NAMES = {
116862
+ [LogLevel.DEBUG]: "debug",
116863
+ [LogLevel.INFO]: "info",
116864
+ [LogLevel.WARN]: "warn",
116865
+ [LogLevel.ERROR]: "error"
116866
+ };
116860
116867
  var Logger = class {
116861
- constructor(writeMessage, loglevel, shouldIncludeTimestamp) {
116862
- this.shouldIncludeTimestamp = shouldIncludeTimestamp !== null && shouldIncludeTimestamp !== void 0 ? shouldIncludeTimestamp : false;
116863
- this.writeMessage = (s) => {
116864
- return writeMessage(this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ${s}` : s);
116865
- };
116868
+ constructor(writeMessage, loglevel, shouldIncludeTimestampOrOptions) {
116869
+ var _a, _b;
116870
+ const options = typeof shouldIncludeTimestampOrOptions === "boolean" ? { shouldIncludeTimestamp: shouldIncludeTimestampOrOptions } : shouldIncludeTimestampOrOptions !== null && shouldIncludeTimestampOrOptions !== void 0 ? shouldIncludeTimestampOrOptions : {};
116871
+ this.rawWriteMessage = writeMessage;
116872
+ this.shouldIncludeTimestamp = (_a = options.shouldIncludeTimestamp) !== null && _a !== void 0 ? _a : false;
116873
+ this.jsonOutput = (_b = options.jsonOutput) !== null && _b !== void 0 ? _b : false;
116866
116874
  this.loglevel = loglevel;
116867
116875
  }
116868
116876
  setLogLevel(newLogLevel) {
@@ -116871,17 +116879,34 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
116871
116879
  setShouldIncludeTime(newShouldIncludeTimestamp) {
116872
116880
  this.shouldIncludeTimestamp = newShouldIncludeTimestamp;
116873
116881
  }
116882
+ setJsonOutput(newJsonOutput) {
116883
+ this.jsonOutput = newJsonOutput;
116884
+ }
116874
116885
  error(s) {
116875
- if (this.loglevel <= LogLevel.ERROR) this.writeMessage(chalk_1.default.red(s) + "\n");
116886
+ if (this.loglevel <= LogLevel.ERROR) this.emit(LogLevel.ERROR, s, chalk_1.default.red);
116876
116887
  }
116877
116888
  warn(s) {
116878
- if (this.loglevel <= LogLevel.WARN) this.writeMessage(chalk_1.default.yellow(s) + "\n");
116889
+ if (this.loglevel <= LogLevel.WARN) this.emit(LogLevel.WARN, s, chalk_1.default.yellow);
116879
116890
  }
116880
116891
  info(s) {
116881
- if (this.loglevel <= LogLevel.INFO) this.writeMessage(s + "\n");
116892
+ if (this.loglevel <= LogLevel.INFO) this.emit(LogLevel.INFO, s);
116882
116893
  }
116883
116894
  debug(s) {
116884
- if (this.loglevel <= LogLevel.DEBUG) this.writeMessage(s + "\n");
116895
+ if (this.loglevel <= LogLevel.DEBUG) this.emit(LogLevel.DEBUG, s);
116896
+ }
116897
+ emit(level, message, colorize) {
116898
+ if (this.jsonOutput) {
116899
+ const payload = {
116900
+ level: LEVEL_NAMES[level],
116901
+ message
116902
+ };
116903
+ if (this.shouldIncludeTimestamp) payload.timestamp = (/* @__PURE__ */ new Date()).toISOString();
116904
+ this.rawWriteMessage(JSON.stringify(payload) + "\n");
116905
+ return;
116906
+ }
116907
+ const prefix = this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ` : "";
116908
+ const body = colorize ? colorize(message) : message;
116909
+ this.rawWriteMessage(prefix + body + "\n");
116885
116910
  }
116886
116911
  };
116887
116912
  exports.Logger = Logger;