@datadog/datadog-ci-plugin-synthetics 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.d.ts CHANGED
@@ -2388,17 +2388,30 @@ declare enum LogLevel {
2388
2388
  WARN = 3,
2389
2389
  ERROR = 4
2390
2390
  }
2391
+ interface LoggerOptions {
2392
+ shouldIncludeTimestamp?: boolean;
2393
+ /**
2394
+ * When `true`, every log call emits a single-line JSON object instead of
2395
+ * ANSI-coloured text. Useful when Datadog itself (or any other log
2396
+ * pipeline) ingests CLI output: each line parses cleanly and `level` is
2397
+ * preserved instead of every `error` showing up as `info`.
2398
+ */
2399
+ jsonOutput?: boolean;
2400
+ }
2391
2401
  declare class Logger {
2392
2402
  private loglevel;
2393
- private writeMessage;
2403
+ private rawWriteMessage;
2394
2404
  private shouldIncludeTimestamp;
2395
- constructor(writeMessage: (s: string) => void, loglevel: LogLevel, shouldIncludeTimestamp?: boolean);
2405
+ private jsonOutput;
2406
+ constructor(writeMessage: (s: string) => void, loglevel: LogLevel, shouldIncludeTimestampOrOptions?: boolean | LoggerOptions);
2396
2407
  setLogLevel(newLogLevel: LogLevel): void;
2397
2408
  setShouldIncludeTime(newShouldIncludeTimestamp: boolean): void;
2409
+ setJsonOutput(newJsonOutput: boolean): void;
2398
2410
  error(s: string): void;
2399
2411
  warn(s: string): void;
2400
2412
  info(s: string): void;
2401
2413
  debug(s: string): void;
2414
+ private emit;
2402
2415
  }
2403
2416
  //#endregion
2404
2417
  //#region src/commands/upload-application.d.ts
package/dist/bundle.js CHANGED
@@ -5761,11 +5761,12 @@ var require_glob = /* @__PURE__ */ __commonJSMin(((exports) => {
5761
5761
  var require_package$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5762
5762
  module.exports = {
5763
5763
  "name": "@datadog/datadog-ci-base",
5764
- "version": "5.18.0",
5764
+ "version": "5.19.0",
5765
5765
  "description": "Base package for Datadog CI",
5766
5766
  "license": "Apache-2.0",
5767
5767
  "keywords": ["datadog", "datadog-ci"],
5768
5768
  "homepage": "https://github.com/DataDog/datadog-ci/tree/master/packages/base",
5769
+ "bugs": { "url": "https://github.com/DataDog/datadog-ci/issues" },
5769
5770
  "repository": {
5770
5771
  "type": "git",
5771
5772
  "url": "https://github.com/DataDog/datadog-ci.git",
@@ -140123,12 +140124,19 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
140123
140124
  LogLevel[LogLevel["WARN"] = 3] = "WARN";
140124
140125
  LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
140125
140126
  })(LogLevel || (exports.LogLevel = LogLevel = {}));
140127
+ const LEVEL_NAMES = {
140128
+ [LogLevel.DEBUG]: "debug",
140129
+ [LogLevel.INFO]: "info",
140130
+ [LogLevel.WARN]: "warn",
140131
+ [LogLevel.ERROR]: "error"
140132
+ };
140126
140133
  var Logger = class {
140127
- constructor(writeMessage, loglevel, shouldIncludeTimestamp) {
140128
- this.shouldIncludeTimestamp = shouldIncludeTimestamp !== null && shouldIncludeTimestamp !== void 0 ? shouldIncludeTimestamp : false;
140129
- this.writeMessage = (s) => {
140130
- return writeMessage(this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ${s}` : s);
140131
- };
140134
+ constructor(writeMessage, loglevel, shouldIncludeTimestampOrOptions) {
140135
+ var _a, _b;
140136
+ const options = typeof shouldIncludeTimestampOrOptions === "boolean" ? { shouldIncludeTimestamp: shouldIncludeTimestampOrOptions } : shouldIncludeTimestampOrOptions !== null && shouldIncludeTimestampOrOptions !== void 0 ? shouldIncludeTimestampOrOptions : {};
140137
+ this.rawWriteMessage = writeMessage;
140138
+ this.shouldIncludeTimestamp = (_a = options.shouldIncludeTimestamp) !== null && _a !== void 0 ? _a : false;
140139
+ this.jsonOutput = (_b = options.jsonOutput) !== null && _b !== void 0 ? _b : false;
140132
140140
  this.loglevel = loglevel;
140133
140141
  }
140134
140142
  setLogLevel(newLogLevel) {
@@ -140137,17 +140145,34 @@ var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
140137
140145
  setShouldIncludeTime(newShouldIncludeTimestamp) {
140138
140146
  this.shouldIncludeTimestamp = newShouldIncludeTimestamp;
140139
140147
  }
140148
+ setJsonOutput(newJsonOutput) {
140149
+ this.jsonOutput = newJsonOutput;
140150
+ }
140140
140151
  error(s) {
140141
- if (this.loglevel <= LogLevel.ERROR) this.writeMessage(chalk_1.default.red(s) + "\n");
140152
+ if (this.loglevel <= LogLevel.ERROR) this.emit(LogLevel.ERROR, s, chalk_1.default.red);
140142
140153
  }
140143
140154
  warn(s) {
140144
- if (this.loglevel <= LogLevel.WARN) this.writeMessage(chalk_1.default.yellow(s) + "\n");
140155
+ if (this.loglevel <= LogLevel.WARN) this.emit(LogLevel.WARN, s, chalk_1.default.yellow);
140145
140156
  }
140146
140157
  info(s) {
140147
- if (this.loglevel <= LogLevel.INFO) this.writeMessage(s + "\n");
140158
+ if (this.loglevel <= LogLevel.INFO) this.emit(LogLevel.INFO, s);
140148
140159
  }
140149
140160
  debug(s) {
140150
- if (this.loglevel <= LogLevel.DEBUG) this.writeMessage(s + "\n");
140161
+ if (this.loglevel <= LogLevel.DEBUG) this.emit(LogLevel.DEBUG, s);
140162
+ }
140163
+ emit(level, message, colorize) {
140164
+ if (this.jsonOutput) {
140165
+ const payload = {
140166
+ level: LEVEL_NAMES[level],
140167
+ message
140168
+ };
140169
+ if (this.shouldIncludeTimestamp) payload.timestamp = (/* @__PURE__ */ new Date()).toISOString();
140170
+ this.rawWriteMessage(JSON.stringify(payload) + "\n");
140171
+ return;
140172
+ }
140173
+ const prefix = this.shouldIncludeTimestamp ? `${(/* @__PURE__ */ new Date()).toISOString()}: ` : "";
140174
+ const body = colorize ? colorize(message) : message;
140175
+ this.rawWriteMessage(prefix + body + "\n");
140151
140176
  }
140152
140177
  };
140153
140178
  exports.Logger = Logger;