Code review comment for lp:~thumper/juju-core/default-command-info

Revision history for this message
Tim Penhey (thumper) wrote :

Reviewers: mp+194061_code.launchpad.net,

Message:
Please take a look.

Description:
Add standard functions for command output.

Add simple function support and flags around changing how the command
output
works by default. Add flag options for '-q' and '--quiet', and provider
a
short '-d' for '--debug'. Also updated the text for the flags.

There are now two methods in the cmd package that should be used for
output:
   cmd.Infof(...)
and
   cmd.Verbosef(...)

If quiet is specified, both are logged instead of written out. If
verbose is
specified, both are written out, if the defaults are used, Info is
written
out, but verbose is logged.

Ideally I'd like to tweak loggo so we can specify the call depth of the
caller, so we can grab the appropriate line numbers etc, but this can
happen
later. Also, now any use of these methods will have the 'juju.cmd'
module. Not
sure if we want to really parameterize that.

The only thing I'm wondering about is Stderr vs. Stdout. Ideally I'd
prefer
to use Stdout where possible, but for the format oriented commands, we
still
want users to be able to go:
   'juju status --format=json | other-thing'
So we don't want to polute Stdout in those situations with output.

There are a number of options here:
  * we just write to Stdout, and have people add '-q'
  * we write the info and verbose info to Stderr so it just works

Then do we have some go to Stdout and some Stderr?

Logging now goes to Stderr, so we could just send all output there
(except for
the actual formatted output).

https://code.launchpad.net/~thumper/juju-core/default-command-info/+merge/194061

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/22320043/

Affected files (+139, -28 lines):
   A [revision details]
   M cmd/export_test.go
   M cmd/logging.go
   M cmd/logging_test.go

« Back to merge proposal