lib/big_brother/cli.rb in big_brother-0.3.0 vs lib/big_brother/cli.rb in big_brother-0.3.1

- old
+ new

@@ -8,10 +8,11 @@ opts.banner = "Usage: bigbro [options]" opts.on("-c", "--config=file", String, "BigBrother configuration file", "Default: /etc/big_brother.conf") { |v| options[:big_brother_config] = v } opts.on("-D", "--data-dir=path", String, "BigBrother data directory", "Default: /etc/big_brother") { |v| options[:config_dir] = v } + opts.on("-v", "--verbose", "Log more verbosely") { options[:verbose] = true } opts.separator "" opts.on("-p", "--port=port", Integer, "Runs BigBrother on the specified port.", "Default: 9292") { |v| options[:Port] = v } @@ -43,14 +44,15 @@ def opt_parser Options.new end def start - if !File.exists?(options[:big_brother_config]) + unless File.exists?(options[:big_brother_config]) puts "Could not find #{options[:big_brother_config]}. Specify correct location with -c file" exit 1 end + BigBrother.logger.level = BigBrother::Logger::Level::DEBUG if options[:verbose] BigBrother.config_dir = options[:config_dir] Thin::Callbacks.after_connect do EM.syslog_setup('0.0.0.0', 514) BigBrother.logger.info "Starting big brother on port #{options[:Port]}"