Log progress and errors to a /tmp/laptop.log file #83

Closed
croaky opened this Issue Apr 6, 2013 · 6 comments

Comments

Projects
None yet
5 participants
Contributor

croaky commented Apr 6, 2013

Thinking about making the script output nothing to stdout but log its progress to a log file for debugging and an easy thing for users to paste into GitHub Issues.

Contributor

Kerrick commented Apr 7, 2013

Re: printing nothing to stdout...

I think that since this script takes a while, if the user sees the script in progress for that long and nothing is printed to stdout, they'll panic and think it has hung. Perhaps piping all of the commands' output to /dev/null but leaving the status updates in?


Re: logging

Logs being left without consent has always been a pet peeve of mine, and I'm sure I'm not the only one that feels that way. However, your /tmp/laptop.log suggestion is much better than ~/.laptop.log, which many scripts are wont to do.

As an alternative, what about adding something in the README on how to easily log? Something like:

If you're having problems use the following command to install instead:

zsh <(curl -s https://raw.github.com/thoughtbot/laptop/master/mac) > ~/laptop.log

This will leave a log file in your home directory called laptop.log that you can submit with a GitHub Issue

Contributor

Kerrick commented Apr 7, 2013

Copying my response from #82 .

I pushed a follow-up commit to this branch that:

  • Removes the extra echos.
  • Does not print anything to stdout.

To take "don't be chatty" to the extreme, piping the output of all the commands to /dev/null may be the best choice, so nothing prints to stdout. But that may cause the user to think the script has stalled, because it's a very long-running process.

The way this follow-up commit goes, it's hard to tell which parts of the stream belong to which process. This may not be an issue if you're just running it and walking away, but if you log it (zsh <(curl -s https://raw.github.com/thoughtbot/laptop/master/mac) > ~/laptop.log) it's nice to see what was attempted before the script failed when it does fail.

To take "don't be chatty" to a moderate level, what @djcp did in the linux files was actually pretty neat: use a fancy_echo function that puts out a status message for each item in color. That way, you get each install/config process separated visually in the terminal and by status messages in any log files--but you don't have to put a bunch of "chatty" blank lines in between.

Contributor

gabebw commented Nov 26, 2013

I like the idea of outputting to STDOUT and outputting to laptop.log, so that the user sees progress, and they have a log they can copy-paste into an issue if anything goes wrong.

Contributor

pbrisbin commented Nov 26, 2013

Rather than adding a bunch of noise to the script to execute each command with redirected output, I would vote for an update to the README letting a user know how to do that if they want or we ask (i.e. for troubleshooting).

$ zsh <(curl ...) |& tee ~/laptop.log

Would output everything to /dev/stdout and ~/laptop.log. I don't know if tee is present by default on OSX though.

Owner

jferris commented Nov 26, 2013

tee is present on OS X by default: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/tee.1.html

On Tuesday, November 26, 2013 at 1:59 PM, patrick brisbin wrote:

Rather than adding a bunch of noise to the script to execute each command with redirected output, I would vote for an update to the README letting a user know how to do that if they want or we ask (i.e. for troubleshooting).
$ zsh <(curl ...) | tee ~/laptop.log
Would output to /dev/stdout and ~/laptop.log. I don't know if tee is present by default on OSX though.


Reply to this email directly or view it on GitHub (#83 (comment)).

Contributor

croaky commented Jul 20, 2014

Done in #256

@croaky croaky closed this Jul 20, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment