lib/semantic_logger/base.rb in semantic_logger-3.2.1 vs lib/semantic_logger/base.rb in semantic_logger-3.3.0
- old
+ new
@@ -209,12 +209,18 @@
def initialize(klass, level=nil, filter=nil)
# Support filtering all messages to this logger using a Regular Expression
# or Proc
raise ':filter must be a Regexp or Proc' unless filter.nil? || filter.is_a?(Regexp) || filter.is_a?(Proc)
- @filter = filter.is_a?(Regexp) ? filter.freeze : filter
- @name = klass.is_a?(String) ? klass : klass.name
- self.level = level unless level.nil?
+ @filter = filter.is_a?(Regexp) ? filter.freeze : filter
+ @name = klass.is_a?(String) ? klass : klass.name
+ if level.nil?
+ # Allow the global default level to determine this loggers log level
+ @level_index = nil
+ @level = nil
+ else
+ self.level = level
+ end
end
# Return the level index for fast comparisons
# Returns the global default level index if the level has not been explicitly
# set for this instance