@adaptic/utils 0.0.955 → 0.0.957
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/index.cjs +12 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +12 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +6 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/misc-utils.d.ts +6 -1
- package/dist/types/misc-utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5273,7 +5273,12 @@ const API_RETRY_CONFIGS = {
|
|
|
5273
5273
|
// Utility function for debug logging
|
|
5274
5274
|
/**
|
|
5275
5275
|
* Debug logging utility that respects environment debug flags.
|
|
5276
|
-
* Logs messages
|
|
5276
|
+
* Logs messages through the configured structured logger when LUMIC_DEBUG
|
|
5277
|
+
* is enabled. The level is preserved by routing through the corresponding
|
|
5278
|
+
* logger method — the structured logger already encodes the level, so we
|
|
5279
|
+
* do NOT prefix the message text with `[DEBUG][LEVEL]` (that produced
|
|
5280
|
+
* malformed `[INFO] [DEBUG][INFO] ...` lines in downstream consumers
|
|
5281
|
+
* that wrap this logger with Pino).
|
|
5277
5282
|
*
|
|
5278
5283
|
* @param message - The message to log.
|
|
5279
5284
|
* @param data - Optional data to log alongside the message. This can be any type of data.
|
|
@@ -5290,31 +5295,29 @@ const logIfDebug = (message, data, type = "info") => {
|
|
|
5290
5295
|
false;
|
|
5291
5296
|
if (!debugMode)
|
|
5292
5297
|
return;
|
|
5293
|
-
const prefix = `[DEBUG][${type.toUpperCase()}]`;
|
|
5294
5298
|
const logger = getLogger();
|
|
5295
5299
|
const context = data !== undefined
|
|
5296
5300
|
? typeof data === "object" && data !== null
|
|
5297
5301
|
? data
|
|
5298
5302
|
: { data }
|
|
5299
5303
|
: undefined;
|
|
5300
|
-
const fullMessage = prefix + " " + message;
|
|
5301
5304
|
switch (type) {
|
|
5302
5305
|
case "error":
|
|
5303
|
-
logger.error(
|
|
5306
|
+
logger.error(message, context);
|
|
5304
5307
|
break;
|
|
5305
5308
|
case "warn":
|
|
5306
|
-
logger.warn(
|
|
5309
|
+
logger.warn(message, context);
|
|
5307
5310
|
break;
|
|
5308
5311
|
case "debug":
|
|
5309
|
-
logger.debug(
|
|
5312
|
+
logger.debug(message, context);
|
|
5310
5313
|
break;
|
|
5311
5314
|
case "trace":
|
|
5312
5315
|
// trace maps to debug in our logger interface
|
|
5313
|
-
logger.debug(
|
|
5316
|
+
logger.debug(message, context);
|
|
5314
5317
|
break;
|
|
5315
5318
|
case "info":
|
|
5316
5319
|
default:
|
|
5317
|
-
logger.info(
|
|
5320
|
+
logger.info(message, context);
|
|
5318
5321
|
}
|
|
5319
5322
|
};
|
|
5320
5323
|
/**
|
|
@@ -8339,7 +8342,7 @@ const fetchTrades = async (symbol, options) => {
|
|
|
8339
8342
|
return massiveLimit(async () => {
|
|
8340
8343
|
const url = `${baseUrl}?${params.toString()}`;
|
|
8341
8344
|
try {
|
|
8342
|
-
|
|
8345
|
+
logIfDebug(`Fetching trades for ${symbol} from ${url}`);
|
|
8343
8346
|
const response = await fetchWithRetry(url, {}, 3, 1000);
|
|
8344
8347
|
const data = (await response.json());
|
|
8345
8348
|
if ("message" in data) {
|