lib/legion/settings.rb in legion-settings-1.1.3 vs lib/legion/settings.rb in legion-settings-1.2.0
- old
+ new
@@ -22,15 +22,15 @@
def get(options = {})
@loader || @loader = load(options)
end
def [](key)
- Legion::Logging.info('Legion::Settings was not loading, auto loading now!') if @loader.nil?
+ logger.info('Legion::Settings was not loading, auto loading now!') if @loader.nil?
@loader = load if @loader.nil?
@loader[key]
rescue NoMethodError, TypeError
- Legion::Logging.fatal 'rescue inside [](key)'
+ logger.fatal 'rescue inside [](key)'
nil
end
def set_prop(key, value)
@loader = load if @loader.nil?
@@ -40,9 +40,18 @@
def merge_settings(key, hash)
@loader = load if @loader.nil?
thing = {}
thing[key.to_sym] = hash
@loader.load_module_settings(thing)
+ end
+
+ def logger
+ @logger = if ::Legion.const_defined?('Logging')
+ ::Legion::Logging
+ else
+ require 'logger'
+ ::Logger.new($stdout)
+ end
end
end
end
end