lib/timber/frameworks.rb in timberio-1.0.0.beta1 vs lib/timber/frameworks.rb in timberio-1.0.0
- old
+ new
@@ -1,21 +1,19 @@
require "logger"
# Attempt to require Rails. We can not list it as a gem
# dependency because we want to support multiple frameworks.
-require("rails") rescue LoadError
+begin
+ require("rails")
+rescue LoadError
+end
-if defined?(Rails)
+if defined?(::Rails) && defined?(::Rails::Railtie)
require 'timber/frameworks/rails'
end
module Timber
+ # Namespace for installing Timber into frameworks
+ # @private
module Frameworks
- def self.logger(logdev)
- if defined?(Timber::Frameworks::Rails)
- Rails.logger(logdev)
- else
- ::Logger.new(logdev)
- end
- end
end
-end
+end
\ No newline at end of file