lib/skylight/util/logging.rb in skylight-1.0.0.beta4 vs lib/skylight/util/logging.rb in skylight-1.0.0.beta5

- old
+ new

@@ -55,10 +55,11 @@ def warn(msg, *args) log :warn, msg, *args end def error(msg, *args) + raise sprintf(msg, *args) if ENV['SKYLIGHT_RAISE_ON_ERROR'] log :error, msg, *args end alias log_trace trace alias log_debug debug @@ -67,11 +68,16 @@ alias log_error error alias fmt sprintf def log(level, msg, *args) - return unless respond_to?(:config) - return unless c = config + c = if respond_to?(:config) + config + elsif self.is_a?(Config) + self + end + + return unless c if logger = c.logger return unless logger.respond_to?(level) if args.length > 0