summaryrefslogtreecommitdiff
path: root/lib/oxidized.rb
diff options
context:
space:
mode:
authorElvin Efendi <elvin.efendiyev@gmail.com>2015-12-13 19:04:57 -0500
committerElvin Efendi <elvin.efendiyev@gmail.com>2015-12-13 19:04:57 -0500
commit1fd8f795e40641356d0a4577744c197723b6a3a1 (patch)
treef505d91af55ee18837d0290f3d9ea7ff8531240b /lib/oxidized.rb
parent82db9fdd9c135a445a4839e39b245a9965091219 (diff)
parent1c4f886e883f947b649613a21955929fa6d7e94c (diff)
Merge pull request #13 from Shopify/refactoring
Refactoring
Diffstat (limited to 'lib/oxidized.rb')
-rw-r--r--lib/oxidized.rb34
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/oxidized.rb b/lib/oxidized.rb
index df30602..e92224a 100644
--- a/lib/oxidized.rb
+++ b/lib/oxidized.rb
@@ -1,6 +1,15 @@
module Oxidized
class OxidizedError < StandardError; end
- Directory = File.expand_path File.join File.dirname(__FILE__), '../'
+
+ Directory = File.expand_path(File.join(File.dirname(__FILE__), '../'))
+
+ require 'oxidized/string'
+ require 'oxidized/config'
+ require 'oxidized/config/vars'
+ require 'oxidized/worker'
+ require 'oxidized/nodes'
+ require 'oxidized/manager'
+ require 'oxidized/hook'
require 'oxidized/core'
def self.asetus
@@ -14,4 +23,27 @@ module Oxidized
def self.config
asetus.cfg
end
+
+ def self.logger
+ @@logger
+ end
+
+ def self.logger=(val)
+ @@logger = val
+ end
+
+ def self.setup_logger
+ self.logger = if config.has_key?('use_syslog') && config.use_syslog
+ require 'syslog/logger'
+ Syslog::Logger.new('oxidized')
+ else
+ require 'logger'
+ if config.has_key?('log')
+ Logger.new(config.log)
+ else
+ Logger.new(STDERR)
+ end
+ end
+ logger.level = Logger::INFO unless config.debug
+ end
end