diff --git a/tools/generate_report.rb b/tools/generate_report.rb index e020f5230da..d0ac13a2ff7 100755 --- a/tools/generate_report.rb +++ b/tools/generate_report.rb @@ -8,6 +8,7 @@ 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 @@ -15,6 +16,13 @@ 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)