lib/wcc/contentful/services.rb in wcc-contentful-1.2.1 vs lib/wcc/contentful/services.rb in wcc-contentful-1.3.0
- old
+ new
@@ -130,9 +130,18 @@
ActiveSupport::Notifications
end
# Allow it to be injected into a store
alias_method :_instrumentation, :instrumentation
+ # Gets the configured logger, defaulting to Rails.logger in a rails context,
+ # or logging to STDERR in a non-rails context.
+ def logger
+ @logger ||=
+ configuration.logger ||
+ (Rails.logger if defined?(Rails)) ||
+ Logger.new($stderr)
+ end
+
##
# This method enables simple dependency injection -
# If the target has a setter matching the name of one of the services,
# set that setter with the value of the service.
def inject_into(target, except: [])