summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2014-11-24 20:49:56 -0800
committerPhil Dibowitz <phil@ipom.com>2014-11-24 20:49:56 -0800
commit7893031d65f7591fd6f3418ec0b1658c5113409b (patch)
treec8de7f50dc0f297072e3ddf430b3f4429ba684c1
parentcbad7c05f9db1ce74e4b4aff4be0ff2031f5ceaa (diff)
downloadchef-zero-7893031d65f7591fd6f3418ec0b1658c5113409b.tar.gz
Add option for logging to a file.
Useful in daemon mode.
-rwxr-xr-xbin/chef-zero9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/chef-zero b/bin/chef-zero
index 2d42468..54739bc 100755
--- a/bin/chef-zero
+++ b/bin/chef-zero
@@ -6,6 +6,7 @@ Signal.trap('INT') { exit 1 }
require 'rubygems'
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
+require 'chef_zero/log'
require 'chef_zero/version'
require 'chef_zero/server'
require 'chef_zero/data_store/raw_file_store'
@@ -50,6 +51,10 @@ OptionParser.new do |opts|
options[:log_level] = value
end
+ opts.on("--log-file FILE", "Log to a file") do |value|
+ options[:log_file] = value
+ end
+
opts.on("--multi-org", "Whether to run in multi-org mode") do |value|
options[:single_org] = nil
end
@@ -77,6 +82,10 @@ if options[:data_store]
options[:data_store] = ChefZero::DataStore::DefaultFacade.new(options[:data_store], options[:single_org], false)
end
+if options[:log_file]
+ ChefZero::Log.init(options[:log_file])
+end
+
server = ChefZero::Server.new(options)
if options[:daemon]