Skip to content

Commit

Permalink
Add logging to standard output for in generate_report.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
lpichler committed May 2, 2019
1 parent cd34aa0 commit 6a5794d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/generate_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@
options = Optimist.options do
opt :user, "userid", :default => "admin"
opt :report_name_or_id, "report name or report id", :short => "n", :type => :string
opt :log_level, "log level (#{Vmdb::LogProxy::LEVELS.join(", ")})", :type => :string
end

# backward compatibility
if ARGV[0].present? && options[:report_name_or_id].nil?
options[:report_name_or_id] = ARGV[0]
end

if options[:log_level]
Optimist.die "Log level #{options[:log_level]} is not supported, supported levels are: #{Vmdb::LogProxy::LEVELS.join(", ")}" unless Vmdb::LogProxy::LEVELS.include?(options[:log_level].to_sym)
$log = VMDBLogger.new(STDOUT)
$log.level = Vmdb::LogProxy::LEVELS.index(options[:log_level].to_sym)
puts "Logging on standard output, log level set to: #{options[:log_level]}"
end

REPORT_PARAMS = {:userid => options[:user], :mode => "async", :report_source => "Requested by user"}.freeze

def report_from_args(options)
Expand Down

0 comments on commit 6a5794d

Please sign in to comment.