summaryrefslogtreecommitdiff
path: root/lib/oxidized/cli.rb
diff options
context:
space:
mode:
authorElvin Efendi <elvin.efendiev@shopify.com>2015-12-09 23:43:32 -0500
committerElvin Efendi <elvin.efendiev@shopify.com>2015-12-13 19:02:36 -0500
commit1c4f886e883f947b649613a21955929fa6d7e94c (patch)
treef505d91af55ee18837d0290f3d9ea7ff8531240b /lib/oxidized/cli.rb
parent82db9fdd9c135a445a4839e39b245a9965091219 (diff)
refactor and fix bugs introduced with new changes
Diffstat (limited to 'lib/oxidized/cli.rb')
-rw-r--r--lib/oxidized/cli.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/oxidized/cli.rb b/lib/oxidized/cli.rb
index fd766e3..15d20c5 100644
--- a/lib/oxidized/cli.rb
+++ b/lib/oxidized/cli.rb
@@ -1,13 +1,14 @@
module Oxidized
class CLI
- require 'oxidized'
require 'slop'
+ require 'oxidized'
def run
check_pid
Process.daemon if @opts[:daemonize]
write_pid
begin
+ Oxidized.logger.info "Oxidized starting, running as pid #{$$}"
Oxidized.new
rescue => error
crash error
@@ -18,15 +19,16 @@ module Oxidized
private
def initialize
- Log.info "Oxidized starting, running as pid #{$$} by #{ENV['USER']}"
_args, @opts = parse_opts
- Oxidized.config.debug = true if @opts[:debug]
+
+ Config.load(@opts)
+ Oxidized.setup_logger
+
@pidfile = File.expand_path("pid")
- Log.debug "pidfile: #{@pidfile}"
end
def crash error
- Log.fatal "Oxidized crashed, crashfile written in #{Config::Crash}"
+ Oxidized.logger.fatal "Oxidized crashed, crashfile written in #{Config::Crash}"
open Config::Crash, 'w' do |file|
file.puts '-' * 50
file.puts Time.now.utc