lib/slf4r/java_logger.rb in slf4r-0.3.0 vs lib/slf4r/java_logger.rb in slf4r-0.3.1
- old
+ new
@@ -11,24 +11,24 @@
public
attr_reader :name
attr_reader :logger
-
+
def initialize(name)
@name = name
@logger = org.slf4j.LoggerFactory.getLogger(name.to_s.sub(/^::/, '').gsub(/::/, '.'))
end
- [:debug, :info, :warn, :error].each do |level|
+ [:debug, :info, :warn, :error, :fatal].each do |level|
class_eval <<-CODE
def #{level}?
@logger.is_#{level}_enabled
end
def #{level}(msg = nil, exception = nil)
if(@logger.is_#{level}_enabled)
- msg, exception = yield if block_given?
+ msg, exception = yield if block_given?
if(exception.type == NativeException)
@logger.#{level}(msg, exception.cause)
else
@logger.#{level}("\#{msg}\#{format(exception)}")
end