lib/slf4r.rb in slf4r-0.3.2 vs lib/slf4r.rb in slf4r-0.3.3
- old
+ new
@@ -1,6 +1,18 @@
require 'slf4r/logger'
begin
- require 'slf4r/java_logger'
+ # make sure we have java
+ require 'java'
+ begin
+ # make sure we have SLF4J in the classloader
+ import 'org.slf4j.LoggerFactory'
+
+ require 'slf4r/java_logger'
+ puts "using slf4j logger"
+ rescue NameError
+ puts "no SLF4J found in classloader - using ruby logger"
+ require 'slf4r/ruby_logger'
+ end
rescue LoadError
+ puts "using ruby logger"
require 'slf4r/ruby_logger'
end