Skip to content

tilt: ^T toggles log timestamps#1274

Merged
landism merged 3 commits into
masterfrom
mlandis/ch1509/add-support-for-adding-timestamps-to-tilt
Mar 12, 2019
Merged

tilt: ^T toggles log timestamps#1274
landism merged 3 commits into
masterfrom
mlandis/ch1509/add-support-for-adding-timestamps-to-tilt

Conversation

@landism

@landism landism commented Mar 8, 2019

Copy link
Copy Markdown
Member

Behavior:
^T toggles timestampped logging
While it's on, all lines are preceded by timestamps.
There is no retroactive adding of timestamps to old lines, and if you turn timestamps back off, the timestamps remain on the old lines.
It's possible at some point we'll save logs with more structure and are able to apply this retroactively, but that didn't seem worth tackling right now.

Leaving this as kind of a hidden feature for now. Filed https://app.clubhouse.io/windmill/story/1798/add-documentation-for-rarer-shortcut-keys to make it discoverable.

It's pretty ugly at default terminal width:
image

  1. The timestamps themselves take up a lot of horizontal space, inducing wrapping (ideally, we could make those lines after, e.g., "Building spoonerisms" dynamically grow depending on timestamps, but whatever).
  2. Since vigoda logs contain timestamps already, those lines now have two timestamps, which is just a bunch of wasted space. Ditto for Tiltfile logs.

@landism
landism force-pushed the mlandis/ch1509/add-support-for-adding-timestamps-to-tilt branch from 59a7ddc to 8139916 Compare March 8, 2019 22:00
l := logger.Get(ctx)
if firstBuild {
p := logger.Blue(l).Sprintf("\n──┤ Building: ")
p := logger.Blue(l).Sprintf("──┤ Building: ")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bug in this PR (and also the existing PrefixedWriter) - if something logs a colored newline, that color will also affect that next line's timestamp/prefix.

This is annoying enough to fix and low enough impact (colored prefixes!) that I figured band-aiding it for now is fine.

@landism
landism requested review from maiamcc and nicks March 8, 2019 22:03
@landism
landism force-pushed the mlandis/ch1509/add-support-for-adding-timestamps-to-tilt branch from 8139916 to 3095332 Compare March 8, 2019 22:04
Comment thread internal/model/log.go Outdated
Comment thread internal/store/engine_state.go
Comment thread internal/model/log.go Outdated
@maiamcc

maiamcc commented Mar 11, 2019

Copy link
Copy Markdown
Contributor

Hmm so this won't work with --hud=false, correct? how much do we care?

@landism

landism commented Mar 11, 2019

Copy link
Copy Markdown
Member Author

Hmm so this won't work with --hud=false, correct? how much do we care?

Correct. Do you think we should care? Do we know of users using --hud=false, or is it mostly just us during development?

@maiamcc

maiamcc commented Mar 11, 2019

Copy link
Copy Markdown
Contributor

Correct. Do you think we should care? Do we know of users using --hud=false, or is it mostly just us during development?

afaik, just us, so go ahead and land and we can figure out a way to add timestamps for --hud=false if/when we need it.

@landism
landism merged commit 892943c into master Mar 12, 2019
@landism
landism deleted the mlandis/ch1509/add-support-for-adding-timestamps-to-tilt branch March 12, 2019 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants