lib/slf4r/ruby_logger.rb in slf4r-0.3.0 vs lib/slf4r/ruby_logger.rb in slf4r-0.3.1
- old
+ new
@@ -1,11 +1,11 @@
require 'logger'
require 'slf4r/abstract_logger_facade'
module Slf4r
class LoggerFacade4RubyLogger
-
+
@@file = STDERR
@@datetime_format = "%Y-%m-%d %H:%M:%S "
def self.new_logger_facade(name)
@name = name
@@ -15,11 +15,11 @@
@logger.datetime_format = @@datetime_format
@logger
end
def self.level=(level)
- @@level = level.instance_of?(Fixnum) ? level :
+ @@level = level.instance_of?(Fixnum) ? level :
::Logger.const_get(level.to_s.upcase)
end
def self.datetime_format=(format)
@@datetime_format = format
@@ -27,13 +27,13 @@
def self.file=(file)
@@file = file
end
end
-
+
class LoggerFacade < AbstractLoggerFacade
-
+
def initialize(name)
super
@logger = LoggerFacade4RubyLogger.new_logger_facade(name)
end
@@ -59,12 +59,16 @@
def _error(msg)
log(::Logger::ERROR, msg)
end
- public
+ def _fatal(msg)
+ log(::Logger::FATAL, msg)
+ end
+ public
+
def debug?
@logger.debug?
end
def info?
@@ -75,8 +79,12 @@
@logger.warn?
end
def error?
@logger.error?
+ end
+
+ def fatal?
+ @logger.fatal?
end
end
end