-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --output-logs= option to turbo CLI #822
Conversation
@chelkyl is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
As a thought, can we also add |
I am wondering if something like similar to
|
Wow, this is exactly what I need 😄 can’t wait to see it merged I think @dcherman’s idea is an interesting. All logs are saved in the |
@weyert That does make a lot of sense! Refactoring. |
CLI option to hide logs of all cached tasks
less single-feature flags and more expandable
@dcherman Great idea! I'll see what can be done and what other features this command could have. |
Nice, liking this. How can we progress this PR? @gsoltis |
I like the idea, but I'm a little concerned about the flag name and option values. As I understand it, this is intended to control the behavior of logging when a cache hit occurs. The various options are "replay the logs", "don't replay the logs", and "replay just the first line that shows a cache hit". Does that seem like an accurate summary?
|
now more specific, also renamed and added more log control modes
@gsoltis Previously, the
It was based on what docker provides and I wanted to keep it to a single word but I agree that it could be clearer! I have renamed it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is coming along!
Can you also resolve any merge conflicts?
dryRun bool | ||
dryRunJson bool | ||
only bool | ||
// Task logs output modes (cached and not cached tasks): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a good candidate for an enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Let me know if you prefer other names/values
cli/internal/run/run.go
Outdated
// full - show all, | ||
// hash - only show task hash, | ||
// none - show nothing | ||
cachedOutputLogsMode string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe cacheHitLogsMode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Done
cli/internal/run/run.go
Outdated
// hash - only show task hash, | ||
// none - show nothing | ||
cachedOutputLogsMode string | ||
notCachedOutputLogsMode string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cacheMissLogsMode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Done
cli/internal/run/run.go
Outdated
@@ -559,6 +572,24 @@ func parseRunArgs(args []string, output cli.Ui) (*RunOptions, error) { | |||
includDepsSet = true | |||
case strings.HasPrefix(arg, "--only"): | |||
runOptions.only = true | |||
case strings.HasPrefix(arg, "--output-logs"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include =
, since we're about to use it in the calculation on the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! Fixed
cli/internal/run/run.go
Outdated
@@ -559,6 +572,24 @@ func parseRunArgs(args []string, output cli.Ui) (*RunOptions, error) { | |||
includDepsSet = true | |||
case strings.HasPrefix(arg, "--only"): | |||
runOptions.only = true | |||
case strings.HasPrefix(arg, "--output-logs"): | |||
outputLogsMode := arg[len("--output-logs="):] | |||
if len(outputLogsMode) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop this check, which will then print out a warning on an empty flag value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me! Done
Thanks! |
--output-logs
option with a few mode options to control output logs of tasks run byturbo run build
full
is default and shows all tasks' process outputhash-only
only outputs the hash line which hascache <miss|hit>, <executing|replaying output> <hash>
new-only
shows all process output for tasks that have not been cached and only the hash line for cached tasksnone
hides all tasks' process outputUsage:
turbo run build --output-logs=new-only
Without --output-logs or --output-logs=full

With --output-logs=hash-only

With --output-logs=new-only

With --output-logs=none

Closes #364