lib/slogger/common_logger.rb in slogger-0.0.4 vs lib/slogger/common_logger.rb in slogger-0.0.5
- old
+ new
@@ -10,11 +10,11 @@
# config.logger = Slogger::CommonLogger.new "rappils", config.log_level, :local0
#
# That's all. The Rails application will log everything to the standard syslog.
#
class CommonLogger < Base
-
+
SEVERITIES = {
:unknow => Syslog::LOG_EMERG,
:fatal => Syslog::LOG_ALERT,
:error => Syslog::LOG_ERR,
:warning => Syslog::LOG_WARNING,
@@ -36,11 +36,11 @@
#
# Just a little sugar
#
FACILITIES = ::Slogger::Base::SYSLOG_FACILITIES
-
+
#
# To build a Slogger::CommonLogger instance.
#
# +app_name+:: The appliaction name to be logged
# +severity+:: The log severity (according to standard Ruby Logger): :unknow, :fatal,
@@ -57,9 +57,13 @@
end
SEVERITIES.each_key do |severity|
define_method severity do |message, &block|
log BRIDGE_SEVERITIES[severity], message, &block
+ end
+
+ define_method "#{severity}?" do
+ SEVERITIES[severity] <= SEVERITIES[@severity]
end
end
end
end