Skip to content

Conversation

@Sayan-995
Copy link
Contributor

What

  • Add -include-timestamp flag to prepend timestamps to follow output lines.
  • Extract timestamps from JSON test events using e.Time.Format() method
  • Preserve original follow output behavior when timestamps are not requested.

without -include-timestamp flag

-follow

image

-follow-verbose

image

-follow-output

image

with -include-timestamp flag

-follow

image

-follow-verbose

image

-follow-output

image

Why

closes #141

Test

image

parse/process.go Outdated
}
fmt.Fprint(option.w, e.Output)
if e.Output != "" && option.includeTimestamp {
fmt.Fprint(option.w, e.Time.Format("2006-01-02T15:04:05.000000-07:00")+" "+e.Output)
Copy link
Owner

Choose a reason for hiding this comment

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

Curious, how did you land on this timestamp format?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was implementing the timestamp feature to match the format shown in the JSON output of the issue (2025-05-05T14:14:46.965151-04:00). The goal was to provide consistent timestamp formatting when using the -include-timestamp flag, similar to what's mentioned in the issue.

I went with a custom format string, but I realize now that might not have been the best approach. Would you prefer I use one of the standard time format constants like time.RFC3339Nano, or do you have a different format in mind for this output?

Copy link
Owner

Choose a reason for hiding this comment

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

When I filed the issue I think I just copied that over from GitHub workflow logs.

I bet we can use one of the time package formats. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the PR to use time.RFC3339Nano instead of the custom format. I believe this should work well for the timestamp output
image

Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if we need tha much granulrity, do you think time.RFC3339 would be good enough (to reduce the line length).

Last question :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that can be a good option , it would reduce the length of the output by 7-8 characters, making it easier to view on a terminal. Updating the PR accordingly.

@mfridman
Copy link
Owner

I merged some other PRs in the meanwhile, mind resolving the conflicts?

@Sayan-995
Copy link
Contributor Author

I merged some other PRs in the meanwhile, mind resolving the conflicts?

resolved

Copy link
Owner

@mfridman mfridman left a comment

Choose a reason for hiding this comment

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

Thanks!

@mfridman mfridman changed the title add Include-timestamp feature feat: add include-timestamp flag Nov 15, 2025
@mfridman mfridman merged commit b6ada0f into mfridman:main Nov 16, 2025
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.

Add optional timestamp flag

2 participants