buildkite / terminal-to-html

Converts arbitrary shell output (with ANSI) into beautifully rendered HTML
http://buildkite.github.io/terminal-to-html
MIT License
642 stars 45 forks source link

Handle custom Buildkite APC escape codes for progress timestamps #66

Closed lox closed 4 years ago

lox commented 4 years ago

This implements parsing of ANSI Application Program Codes, which are per-application escape codes that terminals will ignore.

The initially implemented code is ^[_bk;t=1550440287321^G for outputting per-line timestamps. These get rendered as HTML Processing Instructions: <?bk t="1550440287321"?>. The timestamps are UTC milliseconds since epoch.

The idea is that Buildkite could use these hints to better handle per-line timestamps.

lox commented 4 years ago

@mipearson would welcome your input too, my implementation was a bit hacky. I think I'd probably be inclined to make element and interface with toHTML and then some concrete impls for various things.

felixfbecker commented 4 years ago

Does Buildkite already handle these in the UI?

ticky commented 4 years ago

@felixfbecker yep! If a log has timestamps embedded in it, we show an option to toggle them in the UI. It’s currently an opt-in experiment in the agent, so not an advertised feature, but you can see more details at buildkite/agent#1103