logixia 1.4.0 → 1.6.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/README.md +76 -9
- package/dist/.tsbuildinfo +1 -1
- package/dist/{index-Ium497V3.d.mts → index-C0sp2BVU.d.ts} +2 -2
- package/dist/index-C0sp2BVU.d.ts.map +1 -0
- package/dist/{index-t-ActikQ.d.ts → index-CNSfc_Or.d.mts} +2 -2
- package/dist/index-CNSfc_Or.d.mts.map +1 -0
- package/dist/index.d.mts +281 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +281 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +225 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +222 -20
- package/dist/index.mjs.map +1 -1
- package/dist/{logitron-logger.module-CCnX7GwK.js → logitron-logger.module-B_VVi3P9.js} +74 -48
- package/dist/logitron-logger.module-B_VVi3P9.js.map +1 -0
- package/dist/{logitron-logger.module-C939PIEV.mjs → logitron-logger.module-BauCVR0-.mjs} +74 -48
- package/dist/logitron-logger.module-BauCVR0-.mjs.map +1 -0
- package/dist/{logitron-logger.module-SArymP6b.d.mts → logitron-logger.module-Cu7QdkAm.d.mts} +94 -33
- package/dist/logitron-logger.module-Cu7QdkAm.d.mts.map +1 -0
- package/dist/{logitron-logger.module-9vOhKWDG.d.ts → logitron-logger.module-NI0xuTJj.d.ts} +94 -33
- package/dist/logitron-logger.module-NI0xuTJj.d.ts.map +1 -0
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/nest.d.mts +2 -2
- package/dist/nest.d.ts +2 -2
- package/dist/nest.js +1 -1
- package/dist/nest.mjs +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/transports.d.mts +1 -1
- package/dist/transports.d.ts +1 -1
- package/package.json +1 -1
- package/dist/index-Ium497V3.d.mts.map +0 -1
- package/dist/index-t-ActikQ.d.ts.map +0 -1
- package/dist/logitron-logger.module-9vOhKWDG.d.ts.map +0 -1
- package/dist/logitron-logger.module-C939PIEV.mjs.map +0 -1
- package/dist/logitron-logger.module-CCnX7GwK.js.map +0 -1
- package/dist/logitron-logger.module-SArymP6b.d.mts.map +0 -1
|
@@ -1102,11 +1102,32 @@ var LogixiaLogger = class LogixiaLogger {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
const colorize = ((_this$config$format = this.config.format) === null || _this$config$format === void 0 ? void 0 : _this$config$format.colorize) ?? true;
|
|
1104
1104
|
this._formattedLevels = /* @__PURE__ */ new Map();
|
|
1105
|
+
const _AUTO_PALETTE = [
|
|
1106
|
+
"magenta",
|
|
1107
|
+
"cyan",
|
|
1108
|
+
"yellow",
|
|
1109
|
+
"green",
|
|
1110
|
+
"blue"
|
|
1111
|
+
];
|
|
1112
|
+
const _BUILTIN_LEVELS = new Set([
|
|
1113
|
+
"error",
|
|
1114
|
+
"warn",
|
|
1115
|
+
"info",
|
|
1116
|
+
"debug",
|
|
1117
|
+
"trace",
|
|
1118
|
+
"verbose"
|
|
1119
|
+
]);
|
|
1120
|
+
let _paletteIdx = 0;
|
|
1105
1121
|
for (const [lvl] of this._levelValues) {
|
|
1106
1122
|
const upper = lvl.toUpperCase();
|
|
1107
1123
|
if (colorize && this._fieldCache.get("level") !== false) {
|
|
1108
1124
|
var _this$config$levelOpt3;
|
|
1109
|
-
|
|
1125
|
+
let colorName = (_this$config$levelOpt3 = this.config.levelOptions) === null || _this$config$levelOpt3 === void 0 || (_this$config$levelOpt3 = _this$config$levelOpt3.colors) === null || _this$config$levelOpt3 === void 0 ? void 0 : _this$config$levelOpt3[lvl];
|
|
1126
|
+
if (!colorName) if (_BUILTIN_LEVELS.has(lvl)) colorName = "white";
|
|
1127
|
+
else {
|
|
1128
|
+
colorName = _AUTO_PALETTE[_paletteIdx % _AUTO_PALETTE.length];
|
|
1129
|
+
_paletteIdx++;
|
|
1130
|
+
}
|
|
1110
1131
|
const code = this._colorMap.get(colorName.toLowerCase()) ?? this._colorMap.get("white");
|
|
1111
1132
|
const reset = this._colorMap.get("reset");
|
|
1112
1133
|
this._formattedLevels.set(lvl, `[${code}${upper}${reset}] `);
|
|
@@ -1449,7 +1470,7 @@ function __decorate(decorators, target, key, desc) {
|
|
|
1449
1470
|
var _LogixiaLoggerService;
|
|
1450
1471
|
let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1 {
|
|
1451
1472
|
constructor(config) {
|
|
1452
|
-
this.
|
|
1473
|
+
this._mergedConfig = {
|
|
1453
1474
|
appName: "NestJS-App",
|
|
1454
1475
|
environment: "development",
|
|
1455
1476
|
traceId: true,
|
|
@@ -1486,48 +1507,74 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
|
|
|
1486
1507
|
timeTaken: "[time_taken_MS]"
|
|
1487
1508
|
},
|
|
1488
1509
|
...config
|
|
1489
|
-
}
|
|
1510
|
+
};
|
|
1511
|
+
this.logger = new LogixiaLogger(this._mergedConfig);
|
|
1512
|
+
this._createCustomLevelMethods();
|
|
1513
|
+
}
|
|
1514
|
+
_createCustomLevelMethods() {
|
|
1515
|
+
var _this$_mergedConfig$l;
|
|
1516
|
+
const levels = (_this$_mergedConfig$l = this._mergedConfig.levelOptions) === null || _this$_mergedConfig$l === void 0 ? void 0 : _this$_mergedConfig$l.levels;
|
|
1517
|
+
if (!levels) return;
|
|
1518
|
+
for (const levelName of Object.keys(levels)) {
|
|
1519
|
+
const lower = levelName.toLowerCase();
|
|
1520
|
+
if (typeof this[lower] !== "undefined") continue;
|
|
1521
|
+
this[lower] = async (message, data) => {
|
|
1522
|
+
return this.logger.logLevel(lower, message, data);
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1490
1525
|
}
|
|
1491
1526
|
/**
|
|
1492
|
-
* NestJS LoggerService
|
|
1527
|
+
* NestJS `LoggerService.log` — void, string context.
|
|
1528
|
+
* Maps internally to `info`.
|
|
1529
|
+
*
|
|
1530
|
+
* @example `logger.log('User signed up', 'AuthService')`
|
|
1493
1531
|
*/
|
|
1494
1532
|
log(message, context$1) {
|
|
1495
1533
|
this.setContextIfProvided(context$1);
|
|
1496
1534
|
this.logger.info(this.formatMessage(message)).catch((err) => internalError("LogixiaLoggerService.log failed", err));
|
|
1497
1535
|
}
|
|
1498
|
-
|
|
1536
|
+
/**
|
|
1537
|
+
* Native async `info` — structured data, returns `Promise<void>`.
|
|
1538
|
+
*
|
|
1539
|
+
* @example `await logger.info('User signed up', { userId: 'u_abc' })`
|
|
1540
|
+
*/
|
|
1541
|
+
async info(message, data) {
|
|
1542
|
+
return this.logger.info(message, data);
|
|
1543
|
+
}
|
|
1544
|
+
error(message, dataOrTrace, context$1) {
|
|
1545
|
+
if (typeof dataOrTrace === "object" && dataOrTrace !== null) return message instanceof Error ? this.logger.error(message, dataOrTrace) : this.logger.error(this.formatMessage(message), dataOrTrace);
|
|
1499
1546
|
this.setContextIfProvided(context$1);
|
|
1500
1547
|
const errorData = {};
|
|
1501
|
-
if (
|
|
1502
|
-
(
|
|
1548
|
+
if (typeof dataOrTrace === "string" && dataOrTrace) errorData.stack = dataOrTrace;
|
|
1549
|
+
(message instanceof Error ? this.logger.error(message, errorData) : this.logger.error(this.formatMessage(message), errorData)).catch((err) => internalError("LogixiaLoggerService.error failed", err));
|
|
1503
1550
|
}
|
|
1504
|
-
warn(message,
|
|
1505
|
-
this.
|
|
1551
|
+
warn(message, dataOrContext) {
|
|
1552
|
+
if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.warn(this.formatMessage(message), dataOrContext);
|
|
1553
|
+
this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
|
|
1506
1554
|
this.logger.warn(this.formatMessage(message)).catch((err) => internalError("LogixiaLoggerService.warn failed", err));
|
|
1507
1555
|
}
|
|
1508
|
-
debug(message,
|
|
1509
|
-
this.
|
|
1556
|
+
debug(message, dataOrContext) {
|
|
1557
|
+
if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.debug(this.formatMessage(message), dataOrContext);
|
|
1558
|
+
this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
|
|
1510
1559
|
this.logger.debug(this.formatMessage(message)).catch((err) => internalError("LogixiaLoggerService.debug failed", err));
|
|
1511
1560
|
}
|
|
1512
|
-
verbose(message,
|
|
1513
|
-
this.
|
|
1561
|
+
verbose(message, dataOrContext) {
|
|
1562
|
+
if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.trace(this.formatMessage(message), dataOrContext);
|
|
1563
|
+
this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
|
|
1514
1564
|
this.logger.trace(this.formatMessage(message)).catch((err) => internalError("LogixiaLoggerService.verbose failed", err));
|
|
1515
1565
|
}
|
|
1516
1566
|
/**
|
|
1517
|
-
*
|
|
1567
|
+
* Native async `trace` — lowest verbosity level, structured data.
|
|
1518
1568
|
*/
|
|
1519
|
-
async info(message, data) {
|
|
1520
|
-
return this.logger.info(message, data);
|
|
1521
|
-
}
|
|
1522
1569
|
async trace(message, data) {
|
|
1523
1570
|
return this.logger.trace(message, data);
|
|
1524
1571
|
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Log at any named level with structured data.
|
|
1574
|
+
*/
|
|
1525
1575
|
logLevel(level, message, data) {
|
|
1526
1576
|
return this.logger.logLevel(level, message, data);
|
|
1527
1577
|
}
|
|
1528
|
-
/**
|
|
1529
|
-
* Timing methods
|
|
1530
|
-
*/
|
|
1531
1578
|
time(label) {
|
|
1532
1579
|
this.logger.time(label);
|
|
1533
1580
|
}
|
|
@@ -1537,9 +1584,6 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
|
|
|
1537
1584
|
async timeAsync(label, fn) {
|
|
1538
1585
|
return this.logger.timeAsync(label, fn);
|
|
1539
1586
|
}
|
|
1540
|
-
/**
|
|
1541
|
-
* Context and level management
|
|
1542
|
-
*/
|
|
1543
1587
|
setContext(context$1) {
|
|
1544
1588
|
this.context = context$1;
|
|
1545
1589
|
this.logger.setContext(context$1);
|
|
@@ -1553,30 +1597,24 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
|
|
|
1553
1597
|
getLevel() {
|
|
1554
1598
|
return this.logger.getLevel();
|
|
1555
1599
|
}
|
|
1556
|
-
/**
|
|
1557
|
-
* Create child logger
|
|
1558
|
-
*/
|
|
1559
1600
|
child(context$1, data) {
|
|
1560
1601
|
const childService = new _LogixiaLoggerService();
|
|
1561
1602
|
childService.logger = this.logger.child(context$1, data);
|
|
1562
1603
|
childService.context = context$1;
|
|
1563
1604
|
return childService;
|
|
1564
1605
|
}
|
|
1565
|
-
/**
|
|
1566
|
-
* Get current trace ID
|
|
1567
|
-
*/
|
|
1568
1606
|
getCurrentTraceId() {
|
|
1569
1607
|
return getCurrentTraceId();
|
|
1570
1608
|
}
|
|
1571
|
-
/**
|
|
1572
|
-
* Close logger
|
|
1573
|
-
*/
|
|
1574
1609
|
async close() {
|
|
1575
1610
|
return this.logger.close();
|
|
1576
1611
|
}
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1612
|
+
static create(config) {
|
|
1613
|
+
return new _LogixiaLoggerService(config);
|
|
1614
|
+
}
|
|
1615
|
+
getLogger() {
|
|
1616
|
+
return this.logger;
|
|
1617
|
+
}
|
|
1580
1618
|
setContextIfProvided(context$1) {
|
|
1581
1619
|
if (context$1 && context$1 !== this.context) this.setContext(context$1);
|
|
1582
1620
|
}
|
|
@@ -1585,18 +1623,6 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
|
|
|
1585
1623
|
if (typeof message === "object") return JSON.stringify(message);
|
|
1586
1624
|
return String(message);
|
|
1587
1625
|
}
|
|
1588
|
-
/**
|
|
1589
|
-
* Static factory method for easy instantiation
|
|
1590
|
-
*/
|
|
1591
|
-
static create(config) {
|
|
1592
|
-
return new _LogixiaLoggerService(config);
|
|
1593
|
-
}
|
|
1594
|
-
/**
|
|
1595
|
-
* Get the underlying Logitron logger instance
|
|
1596
|
-
*/
|
|
1597
|
-
getLogger() {
|
|
1598
|
-
return this.logger;
|
|
1599
|
-
}
|
|
1600
1626
|
};
|
|
1601
1627
|
LogixiaLoggerService = _LogixiaLoggerService = __decorate([Injectable({ scope: Scope.TRANSIENT }), __decorateMetadata("design:paramtypes", [Object])], LogixiaLoggerService);
|
|
1602
1628
|
|
|
@@ -10843,4 +10869,4 @@ LogixiaLoggerModule = _LogixiaLoggerModule = __decorate([Module({})], LogixiaLog
|
|
|
10843
10869
|
|
|
10844
10870
|
//#endregion
|
|
10845
10871
|
export { isError as A, createExpressContextMiddleware as B, resetShutdownHandlers as C, getActiveOtelContext as D, disableOtelBridge as E, LogLevel as F, PluginRegistry as I, globalPluginRegistry as L, serializeError as M, DEFAULT_LOG_COLORS as N, getOtelMetaFields as O, DEFAULT_LOG_LEVELS as P, usePlugin as R, registerForShutdown as S, redactObject as T, createFastifyContextHook as V, runWithTraceId as _, TraceMiddleware as a, deregisterFromShutdown as b, __decorate as c, createLogger as d, DEFAULT_TRACE_HEADERS$1 as f, getCurrentTraceId as g, generateTraceId as h, WebSocketTraceInterceptor as i, normalizeError as j, initOtelBridge as k, __decorateMetadata as l, extractTraceId as m, LOGIXIA_LOGGER_PREFIX as n, KafkaTraceInterceptor as o, createTraceMiddleware as p, LogixiaLoggerModule as r, LogixiaLoggerService as s, LOGIXIA_LOGGER_CONFIG as t, LogixiaLogger as u, setTraceId as v, applyRedaction as w, flushOnExit as x, traceStorage as y, LogixiaContext as z };
|
|
10846
|
-
//# sourceMappingURL=logitron-logger.module-
|
|
10872
|
+
//# sourceMappingURL=logitron-logger.module-BauCVR0-.mjs.map
|