[FEATURE] Cleaned up terminal display

This commit is contained in:
Dunemask 2024-02-10 17:36:18 -07:00
parent 4959d6c1fe
commit a804a6e98b
7 changed files with 36 additions and 25 deletions

View file

@ -26,9 +26,13 @@ export async function webConsoleLogs(socket) {
const log = new k8s.Log(kc);
const logStream = new stream.PassThrough();
logStream.on("data", (chunk) =>
socket.emit("push", Buffer.from(chunk).toString()),
);
var logstreamBuffer = "";
logStream.on("data", (chunk) => {
const bufferString = Buffer.from(chunk).toString();
if (!bufferString.includes("\n")) return (logstreamBuffer += bufferString);
const clientChunks = `${logstreamBuffer}${bufferString}`.split("\n");
for (var c of clientChunks) socket.emit("push", c);
});
log
.log(namespace, mcsPods[0], containerName, logStream, {
follow: true,