@514labs/moose-lib 0.6.360 → 0.6.361

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.
@@ -176,11 +176,10 @@ async function getKafkaProducer(cfg, logger, maxMessageBytes) {
176
176
  await producer.connect();
177
177
  return producer;
178
178
  }
179
- var import_http, import_fs, import_path, import_client, import_kafka_javascript, Kafka, compilerLog, antiCachePath, getFileName, getClickhouseClient, cliLog, MAX_RETRIES, MAX_RETRY_TIME_MS, RETRY_INITIAL_TIME_MS, MAX_RETRIES_PRODUCER, RETRY_FACTOR_PRODUCER, ACKs, parseBrokerString, logError, buildSaslConfig, getKafkaClient;
179
+ var import_fs, import_path, import_client, import_kafka_javascript, Kafka, compilerLog, antiCachePath, getFileName, getClickhouseClient, cliLog, MAX_RETRIES, MAX_RETRY_TIME_MS, RETRY_INITIAL_TIME_MS, MAX_RETRIES_PRODUCER, RETRY_FACTOR_PRODUCER, ACKs, parseBrokerString, logError, buildSaslConfig, getKafkaClient;
180
180
  var init_commons = __esm({
181
181
  "src/commons.ts"() {
182
182
  "use strict";
183
- import_http = __toESM(require("http"));
184
183
  import_fs = require("fs");
185
184
  import_path = __toESM(require("path"));
186
185
  import_client = require("@clickhouse/client");
@@ -221,16 +220,17 @@ var init_commons = __esm({
221
220
  });
222
221
  };
223
222
  cliLog = (log) => {
224
- const req = import_http.default.request({
225
- port: parseInt(process.env.MOOSE_MANAGEMENT_PORT ?? "5001"),
226
- method: "POST",
227
- path: "/logs"
228
- });
229
- req.on("error", (err) => {
230
- console.log(`Error ${err.name} sending CLI log.`, err.message);
231
- });
232
- req.write(JSON.stringify({ message_type: "Info", ...log }));
233
- req.end();
223
+ const level = log.message_type === "Error" ? "error" : log.message_type === "Warning" ? "warn" : "info";
224
+ const structuredLog = {
225
+ __moose_structured_log__: true,
226
+ level,
227
+ message: log.message,
228
+ resource_type: "runtime",
229
+ cli_action: log.action,
230
+ cli_message_type: log.message_type ?? "Info",
231
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
232
+ };
233
+ process.stderr.write(JSON.stringify(structuredLog) + "\n");
234
234
  };
235
235
  MAX_RETRIES = 150;
236
236
  MAX_RETRY_TIME_MS = 1e3;