mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
Merge pull request #965 from chef/ssd/expand-path
Expand relative paths based on profile location
This commit is contained in:
commit
622de28f0f
3 changed files with 12 additions and 4 deletions
|
@ -134,7 +134,15 @@ module Inspec
|
|||
# logging singleton Inspec::Log. Eventually it would be nice to
|
||||
# move internal debug logging to use this logging singleton.
|
||||
#
|
||||
Inspec::Log.init(o.log_location)
|
||||
loc = if o.log_location
|
||||
o.log_location
|
||||
elsif %w{json json-min}.include?(o['format'])
|
||||
STDERR
|
||||
else
|
||||
STDOUT
|
||||
end
|
||||
|
||||
Inspec::Log.init(loc)
|
||||
Inspec::Log.level = get_log_level(o.log_level)
|
||||
|
||||
o[:logger] = Logger.new(STDOUT)
|
||||
|
|
|
@ -18,8 +18,8 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|||
class_option :log_level, aliases: :l, type: :string,
|
||||
desc: 'Set the log level: info (default), debug, warn, error'
|
||||
|
||||
class_option :log_location, type: :string, default: STDOUT,
|
||||
desc: 'Location to send diagnostic log messages to. (default: STDOUT)'
|
||||
class_option :log_location, type: :string,
|
||||
desc: 'Location to send diagnostic log messages to. (default: STDOUT or STDERR)'
|
||||
|
||||
class_option :diagnose, type: :boolean,
|
||||
desc: 'Show diagnostics (versions, configurations)'
|
||||
|
|
|
@ -91,7 +91,7 @@ module Inspec
|
|||
|
||||
def source_url
|
||||
if opts[:path]
|
||||
"file://#{opts[:path]}"
|
||||
"file://#{File.expand_path(opts[:path], @cwd)}"
|
||||
elsif opts[:url]
|
||||
opts[:url]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue