lib/dexter/client.rb in pgdexter-0.3.1 vs lib/dexter/client.rb in pgdexter-0.3.2

- old
+ new

@@ -1,7 +1,9 @@ module Dexter class Client + include Logging + attr_reader :arguments, :options def initialize(args) @arguments, @options = parse_args(args) end @@ -12,10 +14,11 @@ if options[:statement] query = Query.new(options[:statement]) Indexer.new(options).process_queries([query]) elsif options[:pg_stat_statements] + # TODO support streaming option Indexer.new(options).process_stat_statements elsif arguments.any? ARGV.replace(arguments) Processor.new(ARGF, options).perform else @@ -33,16 +36,16 @@ o.boolean "--create", "create indexes", default: false o.array "--exclude", "prevent specific tables from being indexed" o.string "--include", "only include specific tables" o.string "--input-format", "input format", default: "stderr" o.integer "--interval", "time to wait between processing queries, in seconds", default: 60 - o.float "--min-calls", "only process queries that have been called a certain number of times", default: 0 - o.float "--min-time", "only process queries that have consumed a certain amount of DB time, in minutes", default: 0 - o.boolean "--pg-stat-statements", "use pg_stat_statements", default: false, help: false o.boolean "--log-explain", "log explain", default: false, help: false o.string "--log-level", "log level", default: "info" o.boolean "--log-sql", "log sql", default: false + o.float "--min-calls", "only process queries that have been called a certain number of times", default: 0 + o.float "--min-time", "only process queries that have consumed a certain amount of DB time, in minutes", default: 0 + o.boolean "--pg-stat-statements", "use pg_stat_statements", default: false, help: false o.string "-s", "--statement", "process a single statement" # separator must go here to show up correctly - slop bug? o.separator "" o.separator "Connection options:" o.on "-v", "--version", "print the version" do @@ -69,12 +72,8 @@ abort "Unknown log level" unless ["error", "info", "debug", "debug2", "debug3"].include?($log_level) [arguments, options] rescue Slop::Error => e abort e.message - end - - def log(message) - $stderr.puts message end end end