Skip to content

Commit

Permalink
strip ansi control characters (I hope) from output
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Aug 13, 2023
1 parent 35f303b commit 92944fa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ The webpage is a bit basic. While this entire project doesn't need much complica

***If you have a large stack of containers, OR you have containers that contain a significant number of log entries, the page will not be available until all log entries are processed. This may take a minute or two to accomplish***

Some containers use "special characters" that your terminal program interprets as color codes. These will show up in the logs as the control characters. This will be improved in future versions.

The page does not auto-scroll to the bottom. This will be improved in future versions.

If a container SHOULD be running, but it is not, the webpage will not show it. This will be improved in future versions.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"dependencies": {
"jquery": "^3.7.0",
"socket.io-client": "^4.7.2"
"socket.io-client": "^4.7.2",
"strip-ansi": "^7.1.0"
}
}
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { io, Socket } from "socket.io-client";
import stripAnsi from "strip-ansi";

declare const window: any;
let containers: any = {};
Expand Down Expand Up @@ -103,7 +104,7 @@ window.show_logs = function (name: any) {
};

function generate_log_element(log: any) {
return `<p>${log}</p>`;
return `<p>${stripAnsi(log)}</p>`;
}

function generate_li_element(name: String) {
Expand Down

0 comments on commit 92944fa

Please sign in to comment.