lib/syslogger.rb in syslogger-1.2.5 vs lib/syslogger.rb in syslogger-1.2.6
- old
+ new
@@ -1,11 +1,11 @@
require 'syslog'
require 'logger'
class Syslogger
- VERSION = "1.2.5"
+ VERSION = "1.2.6"
attr_reader :level, :ident, :options, :facility
MAPPING = {
Logger::DEBUG => Syslog::LOG_DEBUG,
@@ -84,9 +84,15 @@
end
# Sets the minimum level for messages to be written in the log.
# +level+:: one of <tt>Logger::DEBUG</tt>, <tt>Logger::INFO</tt>, <tt>Logger::WARN</tt>, <tt>Logger::ERROR</tt>, <tt>Logger::FATAL</tt>, <tt>Logger::UNKNOWN</tt>
def level=(level)
+ level = Logger.const_get(level.to_s.upcase) if level.is_a?(Symbol)
+
+ unless level.is_a?(Fixnum)
+ raise ArgumentError.new("Invalid logger level `#{level.inspect}`")
+ end
+
@level = level
end
protected