@loglayer/transport-pretty-terminal 2.0.0 → 3.0.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 +2 -4
- package/dist/index.cjs +39 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -18
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -368,7 +368,7 @@ ${this.config.config.separatorColor("TAB to return to detailed view")}`);
|
|
|
368
368
|
footerContent.push(nextLine);
|
|
369
369
|
}
|
|
370
370
|
footerContent.push("");
|
|
371
|
-
footerContent.push(this.config.config.separatorColor("
|
|
371
|
+
footerContent.push(this.config.config.separatorColor("\u2191/\u2193 scroll \u2022 Q/W page up/down \u2022 J raw JSON"));
|
|
372
372
|
footerContent.push(this.config.config.separatorColor("\u2190/\u2192 navigate \u2022 A/S first/last log \u2022 C toggle arrays"));
|
|
373
373
|
const mainContent = [];
|
|
374
374
|
const levelColor = getLevelColor(this.config.entry.level, this.config.config.colors);
|
|
@@ -493,7 +493,16 @@ var SelectionView = class {
|
|
|
493
493
|
const message = entry.message;
|
|
494
494
|
const data = entry.data ? ` ${formatInlineData(JSON.parse(entry.data), this.config.config, 0, 0, true)}` : "";
|
|
495
495
|
const mainLine = `${prefix}${timestamp} ${chevron}${logId} ${message}${data}`;
|
|
496
|
-
|
|
496
|
+
const wrappedText = wrap3(mainLine, this.termWidth - 2, { hard: true });
|
|
497
|
+
if (isSelected) {
|
|
498
|
+
const lines = wrappedText.split("\n");
|
|
499
|
+
console.log(lines[0]);
|
|
500
|
+
for (const line of lines.slice(1)) {
|
|
501
|
+
console.log(` ${this.config.config.selectorColor("\u2502")} ${line}`);
|
|
502
|
+
}
|
|
503
|
+
} else {
|
|
504
|
+
console.log(wrappedText);
|
|
505
|
+
}
|
|
497
506
|
});
|
|
498
507
|
if (endIdx < this.config.logs.length || this.config.newLogCount > 0) {
|
|
499
508
|
const moreLogsText = this.config.newLogCount > 0 ? this.config.config.selectorColor(
|
|
@@ -1050,6 +1059,17 @@ var UIManager = class {
|
|
|
1050
1059
|
}
|
|
1051
1060
|
return;
|
|
1052
1061
|
}
|
|
1062
|
+
if (!this.isSelectionMode && !this.isDetailView && (key?.name === "up" || key?.name === "down")) {
|
|
1063
|
+
this.isSelectionMode = true;
|
|
1064
|
+
this.filterText = "";
|
|
1065
|
+
this.isPaused = true;
|
|
1066
|
+
const storedLogs = this.storage.getAllLogs();
|
|
1067
|
+
this.logs = storedLogs;
|
|
1068
|
+
this.selectedIndex = key.name === "up" ? Math.max(0, this.logs.length - 1) : Math.max(0, this.logs.length - 1);
|
|
1069
|
+
this.renderer.renderSelectionView(this.logs, this.selectedIndex, this.filterText, this.selectionBuffer.length);
|
|
1070
|
+
this.startSelectionViewPolling();
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1053
1073
|
if (!this.isSelectionMode && !this.isDetailView && ch === "c") {
|
|
1054
1074
|
const newMode = this.renderer.cycleViewMode();
|
|
1055
1075
|
console.clear();
|
|
@@ -1068,22 +1088,6 @@ var UIManager = class {
|
|
|
1068
1088
|
}, 3e3);
|
|
1069
1089
|
return;
|
|
1070
1090
|
}
|
|
1071
|
-
if (!this.isSelectionMode && !this.isDetailView && key?.name === "tab") {
|
|
1072
|
-
this.isSelectionMode = true;
|
|
1073
|
-
this.filterText = "";
|
|
1074
|
-
if (this.isPaused) {
|
|
1075
|
-
this.selectionBuffer = [...this.pauseBuffer];
|
|
1076
|
-
this.pauseBuffer = [];
|
|
1077
|
-
const storedLogs = this.storage.getAllLogs();
|
|
1078
|
-
this.logs = storedLogs.slice(0, storedLogs.length - this.selectionBuffer.length);
|
|
1079
|
-
} else {
|
|
1080
|
-
this.updateFilteredLogs();
|
|
1081
|
-
}
|
|
1082
|
-
this.selectedIndex = Math.max(0, this.logs.length - 1);
|
|
1083
|
-
this.renderer.renderSelectionView(this.logs, this.selectedIndex, this.filterText, this.selectionBuffer.length);
|
|
1084
|
-
this.startSelectionViewPolling();
|
|
1085
|
-
return;
|
|
1086
|
-
}
|
|
1087
1091
|
if (this.isSelectionMode) {
|
|
1088
1092
|
if (key) {
|
|
1089
1093
|
switch (key.name) {
|
|
@@ -1147,6 +1151,7 @@ var UIManager = class {
|
|
|
1147
1151
|
}
|
|
1148
1152
|
case "tab": {
|
|
1149
1153
|
this.isSelectionMode = false;
|
|
1154
|
+
this.isPaused = false;
|
|
1150
1155
|
if (this.selectionViewPollInterval) {
|
|
1151
1156
|
clearInterval(this.selectionViewPollInterval);
|
|
1152
1157
|
this.selectionViewPollInterval = null;
|
|
@@ -1157,6 +1162,12 @@ var UIManager = class {
|
|
|
1157
1162
|
for (const entry of logs) {
|
|
1158
1163
|
this.renderer.renderLogLine(entry);
|
|
1159
1164
|
}
|
|
1165
|
+
if (this.selectionBuffer.length > 0) {
|
|
1166
|
+
for (const entry of this.selectionBuffer) {
|
|
1167
|
+
this.renderer.renderLogLine(entry);
|
|
1168
|
+
}
|
|
1169
|
+
this.selectionBuffer = [];
|
|
1170
|
+
}
|
|
1160
1171
|
return;
|
|
1161
1172
|
}
|
|
1162
1173
|
}
|