diff options
author | Seth Vargo <sethvargo@gmail.com> | 2013-05-19 18:29:18 -0500 |
---|---|---|
committer | Seth Vargo <sethvargo@gmail.com> | 2013-05-19 18:29:18 -0500 |
commit | a780cbb788e05b8e0fae20139c8854982dff637d (patch) | |
tree | 75ea5d19407226e0b230a1ac9f7cc74a4cb222da | |
parent | a31f0c5ecc2ec2c8c8722bf6f68bca0bbf4e0bea (diff) | |
download | chef-zero-a780cbb788e05b8e0fae20139c8854982dff637d.tar.gz |
Allow the user to specify any log level
-rwxr-xr-x | bin/chef-zero | 4 | ||||
-rw-r--r-- | lib/chef_zero/server.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/bin/chef-zero b/bin/chef-zero index 4178c1e..b4f7d69 100755 --- a/bin/chef-zero +++ b/bin/chef-zero @@ -24,8 +24,8 @@ OptionParser.new do |opts| options[:generate_real_keys] = value end - opts.on("-d", "--debug", "Show requests and debugging output") do |value| - options[:debug] = true + opts.on("-l", "--log-level LEVEL", "Set the output log level") do |value| + options[:log_level] = value end opts.on_tail("-h", "--help", "Show this message") do diff --git a/lib/chef_zero/server.rb b/lib/chef_zero/server.rb index fcc598b..1534017 100644 --- a/lib/chef_zero/server.rb +++ b/lib/chef_zero/server.rb @@ -56,14 +56,14 @@ require 'chef_zero/endpoints/not_found_endpoint' module ChefZero class Server - DEFAULT_OPTIONS = { host: '127.0.0.1', port: 8889 } + DEFAULT_OPTIONS = { host: '127.0.0.1', port: 8889, log_level: :info } def initialize(options = {}) options = DEFAULT_OPTIONS.merge(options) @url = "http://#{options[:host]}:#{options[:port]}" @generate_real_keys = options[:generate_real_keys] - ChefZero::Log.level = options[:debug] ? :debug : :info + ChefZero::Log.level = options[:log_level].to_sym @server = Puma::Server.new(make_app, Puma::Events.new(STDERR, STDOUT)) @server.add_tcp_listener(options[:host], options[:port]) |