@mcesystems/logging-g4 1.0.71 → 1.0.73
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.js +322 -155
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +322 -155
- package/dist/index.mjs.map +3 -3
- package/dist/types/logic/logClient.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -20275,55 +20275,172 @@ var require_src = __commonJS2({
|
|
|
20275
20275
|
}
|
|
20276
20276
|
});
|
|
20277
20277
|
var import_debug = __toESM2(require_src());
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
}
|
|
20300
|
-
|
|
20301
|
-
|
|
20302
|
-
|
|
20303
|
-
|
|
20304
|
-
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20278
|
+
function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
|
|
20279
|
+
const logInfo22 = (0, import_debug.default)(`${namespace}:info`);
|
|
20280
|
+
const logTask = (0, import_debug.default)(`${namespace}:task`);
|
|
20281
|
+
const logError2 = (0, import_debug.default)(`${namespace}:error`);
|
|
20282
|
+
const logDetail2 = (0, import_debug.default)(`${namespace}:detail`);
|
|
20283
|
+
const logDebug = (0, import_debug.default)(`${namespace}:debug`);
|
|
20284
|
+
const logWarning = (0, import_debug.default)(`${namespace}:warning`);
|
|
20285
|
+
const logColor = (0, import_debug.default)(`${namespace}:color`);
|
|
20286
|
+
logInfo22.color = "19";
|
|
20287
|
+
logTask.color = "25";
|
|
20288
|
+
logError2.color = "1";
|
|
20289
|
+
logDetail2.color = "199";
|
|
20290
|
+
logWarning.color = "186";
|
|
20291
|
+
logDebug.color = "211";
|
|
20292
|
+
logColor.enabled = true;
|
|
20293
|
+
function setNamespace(namespace2) {
|
|
20294
|
+
logInfo22.namespace = `${namespace2}:info`;
|
|
20295
|
+
logTask.namespace = `${namespace2}:task`;
|
|
20296
|
+
logError2.namespace = `${namespace2}:error`;
|
|
20297
|
+
logDetail2.namespace = `${namespace2}:detail`;
|
|
20298
|
+
logWarning.namespace = `${namespace2}:warning`;
|
|
20299
|
+
logDebug.namespace = `${namespace2}:debug`;
|
|
20300
|
+
}
|
|
20301
|
+
function setLogLevel(level) {
|
|
20302
|
+
switch (level) {
|
|
20303
|
+
case "info":
|
|
20304
|
+
logInfo22.enabled = true;
|
|
20305
|
+
logTask.enabled = true;
|
|
20306
|
+
logError2.enabled = true;
|
|
20307
|
+
logWarning.enabled = true;
|
|
20308
|
+
logDetail2.enabled = false;
|
|
20309
|
+
logDebug.enabled = false;
|
|
20310
|
+
break;
|
|
20311
|
+
case "debug":
|
|
20312
|
+
logInfo22.enabled = true;
|
|
20313
|
+
logTask.enabled = true;
|
|
20314
|
+
logError2.enabled = true;
|
|
20315
|
+
logWarning.enabled = true;
|
|
20316
|
+
logDetail2.enabled = true;
|
|
20317
|
+
logDebug.enabled = true;
|
|
20318
|
+
break;
|
|
20319
|
+
case "none":
|
|
20320
|
+
logInfo22.enabled = false;
|
|
20321
|
+
logTask.enabled = false;
|
|
20322
|
+
logError2.enabled = false;
|
|
20323
|
+
logWarning.enabled = false;
|
|
20324
|
+
logDetail2.enabled = false;
|
|
20325
|
+
logDebug.enabled = false;
|
|
20326
|
+
break;
|
|
20327
|
+
}
|
|
20328
|
+
}
|
|
20329
|
+
setLogLevel(logLevel);
|
|
20330
|
+
function setColors(type, color) {
|
|
20331
|
+
switch (type) {
|
|
20332
|
+
case "info":
|
|
20333
|
+
logInfo22.color = color;
|
|
20334
|
+
break;
|
|
20335
|
+
case "task":
|
|
20336
|
+
logTask.color = color;
|
|
20337
|
+
break;
|
|
20338
|
+
case "error":
|
|
20339
|
+
logError2.color = color;
|
|
20340
|
+
break;
|
|
20341
|
+
case "detail":
|
|
20342
|
+
logDetail2.color = color;
|
|
20343
|
+
break;
|
|
20344
|
+
case "warning":
|
|
20345
|
+
logWarning.color = color;
|
|
20346
|
+
break;
|
|
20347
|
+
case "debug":
|
|
20348
|
+
logDebug.color = color;
|
|
20349
|
+
break;
|
|
20350
|
+
default:
|
|
20351
|
+
throw new Error(`Invalid log type: ${type}`);
|
|
20352
|
+
}
|
|
20353
|
+
}
|
|
20354
|
+
function printColors() {
|
|
20355
|
+
for (let i = 0; i < 256; i++) {
|
|
20356
|
+
logColor.color = `${i}`;
|
|
20357
|
+
logColor(`${i}: ${i}`);
|
|
20358
|
+
}
|
|
20359
|
+
}
|
|
20360
|
+
function logDataDetail(data, prefix = "# ") {
|
|
20361
|
+
if (data === null || data === void 0) {
|
|
20362
|
+
return `${prefix}<null or undefined>`;
|
|
20363
|
+
}
|
|
20364
|
+
if (typeof data !== "object") {
|
|
20365
|
+
return `${prefix}${String(data)}`;
|
|
20366
|
+
}
|
|
20367
|
+
const keys = Object.keys(data);
|
|
20368
|
+
let result = "";
|
|
20369
|
+
for (const key of keys) {
|
|
20370
|
+
result += `${prefix}${key}: `;
|
|
20371
|
+
if (key in data) {
|
|
20372
|
+
let dataKey = key;
|
|
20373
|
+
if (key in data) {
|
|
20374
|
+
dataKey = key;
|
|
20375
|
+
const value = data[dataKey];
|
|
20376
|
+
if (value === null || value === void 0) {
|
|
20377
|
+
result += `<${value === null ? "null" : "undefined"}>
|
|
20378
|
+
`;
|
|
20379
|
+
} else if (typeof value === "object") {
|
|
20380
|
+
result += `
|
|
20381
|
+
${logDataDetail(value, `${prefix} `)}
|
|
20382
|
+
`;
|
|
20383
|
+
} else {
|
|
20384
|
+
result += `${value}
|
|
20385
|
+
`;
|
|
20386
|
+
}
|
|
20387
|
+
}
|
|
20388
|
+
}
|
|
20389
|
+
}
|
|
20390
|
+
return result.trim();
|
|
20391
|
+
}
|
|
20392
|
+
function header(title, padding = 0) {
|
|
20393
|
+
return `${" ".repeat(padding)}${"=".repeat(80)}
|
|
20394
|
+
${" ".repeat(40 - title.length / 2)}${title}
|
|
20395
|
+
${" ".repeat(padding)}${"=".repeat(80)}`;
|
|
20396
|
+
}
|
|
20397
|
+
function logHeader(title) {
|
|
20398
|
+
logInfo22(`${header(title, 2)}`);
|
|
20399
|
+
}
|
|
20400
|
+
function logDataObject2(title, ...args) {
|
|
20401
|
+
const stack = new Error().stack?.split("\n")[2] || "";
|
|
20402
|
+
const stackMatch = stack.match(/\((.*):(\d+):(\d+)\)$/) || stack.match(/at (.*):(\d+):(\d+)$/);
|
|
20403
|
+
let callerDetails = "";
|
|
20404
|
+
if (stackMatch) {
|
|
20405
|
+
const functionMatch = stack.match(/at (.+) \(/);
|
|
20406
|
+
const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
|
|
20407
|
+
callerDetails = `${functionName}`;
|
|
20408
|
+
}
|
|
20409
|
+
logDetail2(`${header(`*${title}* ${callerDetails}`)}
|
|
20410
|
+
${args.reduce((acc, arg) => `${acc}
|
|
20411
|
+
${logDataDetail(arg)}`, "")}
|
|
20412
|
+
|
|
20413
|
+
${"=".repeat(80)}`);
|
|
20414
|
+
}
|
|
20415
|
+
function logErrorObject2(error, extraDetails) {
|
|
20416
|
+
if (error instanceof Error) {
|
|
20417
|
+
logError2(`${extraDetails ? header(extraDetails, 1) : header(error.message, 1)}
|
|
20418
|
+
Error Message:
|
|
20419
|
+
${error.message}
|
|
20420
|
+
Error Stack:
|
|
20421
|
+
${error.stack}
|
|
20422
|
+
${"=".repeat(80)}`);
|
|
20423
|
+
} else {
|
|
20424
|
+
logError2(`${extraDetails ? header(extraDetails, 1) : header(String(error), 1)}
|
|
20425
|
+
${"=".repeat(80)}`);
|
|
20426
|
+
}
|
|
20326
20427
|
}
|
|
20428
|
+
return {
|
|
20429
|
+
logInfo: logInfo22,
|
|
20430
|
+
logTask,
|
|
20431
|
+
logError: logError2,
|
|
20432
|
+
logDetail: logDetail2,
|
|
20433
|
+
logDebug,
|
|
20434
|
+
logWarning,
|
|
20435
|
+
logColor,
|
|
20436
|
+
setColors,
|
|
20437
|
+
printColors,
|
|
20438
|
+
logHeader,
|
|
20439
|
+
logDataObject: logDataObject2,
|
|
20440
|
+
logErrorObject: logErrorObject2,
|
|
20441
|
+
setLogLevel,
|
|
20442
|
+
setNamespace
|
|
20443
|
+
};
|
|
20327
20444
|
}
|
|
20328
20445
|
var AUTHORIZE_QUERY = `
|
|
20329
20446
|
query Authorize($input: AuthorizeInput!) {
|
|
@@ -20342,8 +20459,7 @@ var TOKEN_QUERY = `
|
|
|
20342
20459
|
}
|
|
20343
20460
|
}
|
|
20344
20461
|
`;
|
|
20345
|
-
|
|
20346
|
-
logNamespace("auth");
|
|
20462
|
+
var { logInfo } = createLoggers("auth");
|
|
20347
20463
|
var random = promisify(randomBytes);
|
|
20348
20464
|
async function getAuthToken(credentials, apiUrl) {
|
|
20349
20465
|
const authApiUrl = apiUrl || process.env.AUTH_API_URL;
|
|
@@ -21264,120 +21380,172 @@ var require_src4 = __commonJS3({
|
|
|
21264
21380
|
}
|
|
21265
21381
|
});
|
|
21266
21382
|
var import_debug2 = __toESM3(require_src4());
|
|
21267
|
-
|
|
21268
|
-
|
|
21269
|
-
|
|
21270
|
-
|
|
21271
|
-
|
|
21272
|
-
|
|
21273
|
-
|
|
21274
|
-
|
|
21275
|
-
|
|
21276
|
-
|
|
21277
|
-
|
|
21278
|
-
|
|
21279
|
-
|
|
21280
|
-
|
|
21281
|
-
|
|
21282
|
-
|
|
21283
|
-
|
|
21284
|
-
|
|
21285
|
-
|
|
21286
|
-
|
|
21287
|
-
|
|
21288
|
-
}
|
|
21289
|
-
|
|
21290
|
-
|
|
21291
|
-
|
|
21292
|
-
|
|
21293
|
-
|
|
21294
|
-
|
|
21295
|
-
|
|
21296
|
-
|
|
21297
|
-
|
|
21298
|
-
|
|
21299
|
-
|
|
21300
|
-
|
|
21301
|
-
|
|
21302
|
-
|
|
21303
|
-
|
|
21304
|
-
|
|
21305
|
-
|
|
21306
|
-
|
|
21307
|
-
|
|
21308
|
-
|
|
21309
|
-
|
|
21310
|
-
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
}
|
|
21317
|
-
|
|
21318
|
-
|
|
21319
|
-
|
|
21320
|
-
|
|
21321
|
-
|
|
21322
|
-
|
|
21323
|
-
|
|
21324
|
-
|
|
21325
|
-
|
|
21326
|
-
|
|
21327
|
-
|
|
21328
|
-
|
|
21329
|
-
|
|
21383
|
+
function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
|
|
21384
|
+
const logInfo3 = (0, import_debug2.default)(`${namespace}:info`);
|
|
21385
|
+
const logTask = (0, import_debug2.default)(`${namespace}:task`);
|
|
21386
|
+
const logError2 = (0, import_debug2.default)(`${namespace}:error`);
|
|
21387
|
+
const logDetail2 = (0, import_debug2.default)(`${namespace}:detail`);
|
|
21388
|
+
const logDebug = (0, import_debug2.default)(`${namespace}:debug`);
|
|
21389
|
+
const logWarning = (0, import_debug2.default)(`${namespace}:warning`);
|
|
21390
|
+
const logColor = (0, import_debug2.default)(`${namespace}:color`);
|
|
21391
|
+
logInfo3.color = "19";
|
|
21392
|
+
logTask.color = "25";
|
|
21393
|
+
logError2.color = "1";
|
|
21394
|
+
logDetail2.color = "199";
|
|
21395
|
+
logWarning.color = "186";
|
|
21396
|
+
logDebug.color = "211";
|
|
21397
|
+
logColor.enabled = true;
|
|
21398
|
+
function setNamespace(namespace2) {
|
|
21399
|
+
logInfo3.namespace = `${namespace2}:info`;
|
|
21400
|
+
logTask.namespace = `${namespace2}:task`;
|
|
21401
|
+
logError2.namespace = `${namespace2}:error`;
|
|
21402
|
+
logDetail2.namespace = `${namespace2}:detail`;
|
|
21403
|
+
logWarning.namespace = `${namespace2}:warning`;
|
|
21404
|
+
logDebug.namespace = `${namespace2}:debug`;
|
|
21405
|
+
}
|
|
21406
|
+
function setLogLevel(level) {
|
|
21407
|
+
switch (level) {
|
|
21408
|
+
case "info":
|
|
21409
|
+
logInfo3.enabled = true;
|
|
21410
|
+
logTask.enabled = true;
|
|
21411
|
+
logError2.enabled = true;
|
|
21412
|
+
logWarning.enabled = true;
|
|
21413
|
+
logDetail2.enabled = false;
|
|
21414
|
+
logDebug.enabled = false;
|
|
21415
|
+
break;
|
|
21416
|
+
case "debug":
|
|
21417
|
+
logInfo3.enabled = true;
|
|
21418
|
+
logTask.enabled = true;
|
|
21419
|
+
logError2.enabled = true;
|
|
21420
|
+
logWarning.enabled = true;
|
|
21421
|
+
logDetail2.enabled = true;
|
|
21422
|
+
logDebug.enabled = true;
|
|
21423
|
+
break;
|
|
21424
|
+
case "none":
|
|
21425
|
+
logInfo3.enabled = false;
|
|
21426
|
+
logTask.enabled = false;
|
|
21427
|
+
logError2.enabled = false;
|
|
21428
|
+
logWarning.enabled = false;
|
|
21429
|
+
logDetail2.enabled = false;
|
|
21430
|
+
logDebug.enabled = false;
|
|
21431
|
+
break;
|
|
21432
|
+
}
|
|
21433
|
+
}
|
|
21434
|
+
setLogLevel(logLevel);
|
|
21435
|
+
function setColors(type, color) {
|
|
21436
|
+
switch (type) {
|
|
21437
|
+
case "info":
|
|
21438
|
+
logInfo3.color = color;
|
|
21439
|
+
break;
|
|
21440
|
+
case "task":
|
|
21441
|
+
logTask.color = color;
|
|
21442
|
+
break;
|
|
21443
|
+
case "error":
|
|
21444
|
+
logError2.color = color;
|
|
21445
|
+
break;
|
|
21446
|
+
case "detail":
|
|
21447
|
+
logDetail2.color = color;
|
|
21448
|
+
break;
|
|
21449
|
+
case "warning":
|
|
21450
|
+
logWarning.color = color;
|
|
21451
|
+
break;
|
|
21452
|
+
case "debug":
|
|
21453
|
+
logDebug.color = color;
|
|
21454
|
+
break;
|
|
21455
|
+
default:
|
|
21456
|
+
throw new Error(`Invalid log type: ${type}`);
|
|
21457
|
+
}
|
|
21458
|
+
}
|
|
21459
|
+
function printColors() {
|
|
21460
|
+
for (let i = 0; i < 256; i++) {
|
|
21461
|
+
logColor.color = `${i}`;
|
|
21462
|
+
logColor(`${i}: ${i}`);
|
|
21463
|
+
}
|
|
21464
|
+
}
|
|
21465
|
+
function logDataDetail(data, prefix = "# ") {
|
|
21466
|
+
if (data === null || data === void 0) {
|
|
21467
|
+
return `${prefix}<null or undefined>`;
|
|
21468
|
+
}
|
|
21469
|
+
if (typeof data !== "object") {
|
|
21470
|
+
return `${prefix}${String(data)}`;
|
|
21471
|
+
}
|
|
21472
|
+
const keys = Object.keys(data);
|
|
21473
|
+
let result = "";
|
|
21474
|
+
for (const key of keys) {
|
|
21475
|
+
result += `${prefix}${key}: `;
|
|
21330
21476
|
if (key in data) {
|
|
21331
|
-
dataKey = key;
|
|
21332
|
-
|
|
21333
|
-
|
|
21334
|
-
|
|
21477
|
+
let dataKey = key;
|
|
21478
|
+
if (key in data) {
|
|
21479
|
+
dataKey = key;
|
|
21480
|
+
const value = data[dataKey];
|
|
21481
|
+
if (value === null || value === void 0) {
|
|
21482
|
+
result += `<${value === null ? "null" : "undefined"}>
|
|
21335
21483
|
`;
|
|
21336
|
-
|
|
21337
|
-
|
|
21338
|
-
${logDataDetail(value, `${prefix} `)}
|
|
21484
|
+
} else if (typeof value === "object") {
|
|
21485
|
+
result += `
|
|
21486
|
+
${logDataDetail(value, `${prefix} `)}
|
|
21339
21487
|
`;
|
|
21340
|
-
|
|
21341
|
-
|
|
21488
|
+
} else {
|
|
21489
|
+
result += `${value}
|
|
21342
21490
|
`;
|
|
21491
|
+
}
|
|
21343
21492
|
}
|
|
21344
21493
|
}
|
|
21345
21494
|
}
|
|
21495
|
+
return result.trim();
|
|
21346
21496
|
}
|
|
21347
|
-
|
|
21348
|
-
}
|
|
21349
|
-
function header(title, padding = 0) {
|
|
21350
|
-
return `${" ".repeat(padding)}${"=".repeat(80)}
|
|
21497
|
+
function header(title, padding = 0) {
|
|
21498
|
+
return `${" ".repeat(padding)}${"=".repeat(80)}
|
|
21351
21499
|
${" ".repeat(40 - title.length / 2)}${title}
|
|
21352
21500
|
${" ".repeat(padding)}${"=".repeat(80)}`;
|
|
21353
|
-
}
|
|
21354
|
-
function
|
|
21355
|
-
|
|
21356
|
-
|
|
21357
|
-
|
|
21358
|
-
|
|
21359
|
-
const
|
|
21360
|
-
|
|
21361
|
-
|
|
21362
|
-
|
|
21363
|
-
|
|
21501
|
+
}
|
|
21502
|
+
function logHeader(title) {
|
|
21503
|
+
logInfo3(`${header(title, 2)}`);
|
|
21504
|
+
}
|
|
21505
|
+
function logDataObject2(title, ...args) {
|
|
21506
|
+
const stack = new Error().stack?.split("\n")[2] || "";
|
|
21507
|
+
const stackMatch = stack.match(/\((.*):(\d+):(\d+)\)$/) || stack.match(/at (.*):(\d+):(\d+)$/);
|
|
21508
|
+
let callerDetails = "";
|
|
21509
|
+
if (stackMatch) {
|
|
21510
|
+
const functionMatch = stack.match(/at (.+) \(/);
|
|
21511
|
+
const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
|
|
21512
|
+
callerDetails = `${functionName}`;
|
|
21513
|
+
}
|
|
21514
|
+
logDetail2(`${header(`*${title}* ${callerDetails}`)}
|
|
21364
21515
|
${args.reduce((acc, arg) => `${acc}
|
|
21365
21516
|
${logDataDetail(arg)}`, "")}
|
|
21366
|
-
|
|
21517
|
+
|
|
21367
21518
|
${"=".repeat(80)}`);
|
|
21368
|
-
}
|
|
21369
|
-
function logErrorObject(error, extraDetails) {
|
|
21370
|
-
if (error instanceof Error) {
|
|
21371
|
-
logError2(`${extraDetails ? header(extraDetails, 1) : header(error.message, 1)}
|
|
21372
|
-
Error Message:
|
|
21373
|
-
${error.message}
|
|
21374
|
-
Error Stack:
|
|
21375
|
-
${error.stack}
|
|
21376
|
-
${"=".repeat(80)}`);
|
|
21377
|
-
} else {
|
|
21378
|
-
logError2(`${extraDetails ? header(extraDetails, 1) : header(String(error), 1)}
|
|
21379
|
-
${"=".repeat(80)}`);
|
|
21380
21519
|
}
|
|
21520
|
+
function logErrorObject2(error, extraDetails) {
|
|
21521
|
+
if (error instanceof Error) {
|
|
21522
|
+
logError2(`${extraDetails ? header(extraDetails, 1) : header(error.message, 1)}
|
|
21523
|
+
Error Message:
|
|
21524
|
+
${error.message}
|
|
21525
|
+
Error Stack:
|
|
21526
|
+
${error.stack}
|
|
21527
|
+
${"=".repeat(80)}`);
|
|
21528
|
+
} else {
|
|
21529
|
+
logError2(`${extraDetails ? header(extraDetails, 1) : header(String(error), 1)}
|
|
21530
|
+
${"=".repeat(80)}`);
|
|
21531
|
+
}
|
|
21532
|
+
}
|
|
21533
|
+
return {
|
|
21534
|
+
logInfo: logInfo3,
|
|
21535
|
+
logTask,
|
|
21536
|
+
logError: logError2,
|
|
21537
|
+
logDetail: logDetail2,
|
|
21538
|
+
logDebug,
|
|
21539
|
+
logWarning,
|
|
21540
|
+
logColor,
|
|
21541
|
+
setColors,
|
|
21542
|
+
printColors,
|
|
21543
|
+
logHeader,
|
|
21544
|
+
logDataObject: logDataObject2,
|
|
21545
|
+
logErrorObject: logErrorObject2,
|
|
21546
|
+
setLogLevel,
|
|
21547
|
+
setNamespace
|
|
21548
|
+
};
|
|
21381
21549
|
}
|
|
21382
21550
|
|
|
21383
21551
|
// ../../node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/stringify.js
|
|
@@ -21477,6 +21645,7 @@ async function deletePendingEvents(filePath) {
|
|
|
21477
21645
|
}
|
|
21478
21646
|
|
|
21479
21647
|
// src/logic/logClient.ts
|
|
21648
|
+
var { logInfo: logInfo2, logError, logErrorObject, logDetail, logDataObject } = createLoggers2("logging");
|
|
21480
21649
|
var LogClient = class {
|
|
21481
21650
|
credentials;
|
|
21482
21651
|
loggingClient;
|
|
@@ -21490,8 +21659,6 @@ var LogClient = class {
|
|
|
21490
21659
|
sendInProgress = false;
|
|
21491
21660
|
schedulerStarted = false;
|
|
21492
21661
|
async init() {
|
|
21493
|
-
setLogLevel2(process.env.LOG_LEVEL ?? "none");
|
|
21494
|
-
logNamespace2("logging");
|
|
21495
21662
|
if (typeof this.timeBetweenLogMs !== "number") {
|
|
21496
21663
|
const DEFAULT_TIME_BETWEEN_LOG_MS = 10 * 60 * 1e3;
|
|
21497
21664
|
const DEFAULT_MAX_OFFLINE_TIME_MS = 60 * 60 * 1e3;
|
|
@@ -21520,7 +21687,7 @@ var LogClient = class {
|
|
|
21520
21687
|
const tokenData = await fs.readFile(tokenFilePath, "utf-8");
|
|
21521
21688
|
tokenFile = JSON.parse(tokenData);
|
|
21522
21689
|
logInfo2(`Loaded token from temp file: ${tokenFilePath}`);
|
|
21523
|
-
|
|
21690
|
+
logDetail(
|
|
21524
21691
|
`Token will expire ${(tokenFile.time + tokenFile.token.expiresIn * 1e3 - Date.now()) / (1e3 * 60)} minutes`
|
|
21525
21692
|
);
|
|
21526
21693
|
} catch (_error) {
|
|
@@ -21554,7 +21721,7 @@ var LogClient = class {
|
|
|
21554
21721
|
this.loggingClient = new import_gql_logging_client.default(loggingApi, token.accessToken);
|
|
21555
21722
|
this.initialized = true;
|
|
21556
21723
|
} else {
|
|
21557
|
-
|
|
21724
|
+
logError("Check your internet connection - token not found");
|
|
21558
21725
|
}
|
|
21559
21726
|
if (!this.schedulerStarted) {
|
|
21560
21727
|
this.schedulerStarted = true;
|
|
@@ -21610,7 +21777,7 @@ var LogClient = class {
|
|
|
21610
21777
|
this.firstOfflineTime = void 0;
|
|
21611
21778
|
logInfo2(`Logging batch result: ${batch.length} events sent`);
|
|
21612
21779
|
} catch (error) {
|
|
21613
|
-
|
|
21780
|
+
logError("Send batch failed", error);
|
|
21614
21781
|
if (this.firstOfflineTime === void 0) {
|
|
21615
21782
|
this.firstOfflineTime = Date.now();
|
|
21616
21783
|
}
|