basic logging setup for inspec exec

This change tries hard to stay backward compatible: if you ask for JSON
output, you will NOT get any logging.

Fixes #349.
This commit is contained in:
Stephan Renatus 2016-01-27 17:24:15 +01:00
parent 1f325b1cfd
commit e1d5b2be92

View file

@ -107,7 +107,10 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
def exec(*tests)
diagnose
runner = Inspec::Runner.new(opts)
o = opts.dup
o[:logger] = Logger.new(opts['format'] == 'json' ? nil : STDOUT)
runner = Inspec::Runner.new(o)
runner.add_tests(tests)
exit runner.run
rescue RuntimeError => e