-
Notifications
You must be signed in to change notification settings - Fork 5
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
Universal output redirection, more exit handling #35
Conversation
Trading one junk drawer for another, to some extent (I hate code called "util"), but it does seem fair to say at least that none of this code will be used outside of executor implementations. Signed-off-by: Eric Myhre <hash@exultant.us>
Signed-off-by: Eric Myhre <hash@exultant.us>
Signed-off-by: Eric Myhre <hash@exultant.us>
All tests toss output on the floor. The real main message passes information to the user on os.Stderr. Signed-off-by: Eric Myhre <hash@exultant.us>
Signed-off-by: Eric Myhre <hash@exultant.us>
This is the last thing that was pushing output out-of-place through our test harnesses! Hooray! Signed-off-by: Eric Myhre <hash@exultant.us>
Signed-off-by: Eric Myhre <hash@exultant.us>
fmt.Fprintf(logFile, "\n") | ||
fmt.Fprintf(logFile, "Full error:\n") | ||
fmt.Fprintf(logFile, "-----------\n") | ||
fmt.Fprintf(logFile, "%s\n", caught) |
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.
Print the message without the stack?
LGTM for an initial overhaul. This looks good until we get more aggressive about an output overhaul. |
Simultaneously, add a little more data to the full form logs. The structural serialization is often redundant... but occasionally adds some really useful precision. Signed-off-by: Eric Myhre <hash@exultant.us>
4cdd225
to
695a23b
Compare
Added a little more terseness for the default user facing message; should be better. |
Universal output redirection, more exit handling
All output from the CLI can now be shunted to any
io.Writer
. Tests can use this to check output. Right now, existing tests route everything toioutil.Discard
for lack of any useful assertions.This cleans up all output leaking through test reports, making reading much more pleasant again.
Introduced new errors for user-facing messages, with graceful reporting for and a mechanism for custom exit codes, as well as a polite logging mechanism for unexpected errors.