lib/lumber/lumber.rb in lumber-0.12.2 vs lib/lumber/lumber.rb in lumber-0.12.3
- old
+ new
@@ -180,10 +180,10 @@
# otherwise, walk up the classes hierarchy till you find a logger
# that was registered, and use that logger as the parent for the
# logger of the new class
parent = clazz.superclass
while ! parent.nil?
- parent_logger_name = parent.logger.fullname rescue ''
+ parent_logger_name = (parent.respond_to?(:logger) && parent.logger.respond_to?(:fullname)) ? parent.logger.fullname : ''
parent_is_registered = @@registered_loggers.values.find {|v| parent_logger_name.index(v) == 0}
if parent_is_registered && parent.method_defined?(:logger=)
fullname = "#{parent_logger_name}::#{clazz.name.nil? ? 'anonymous' : clazz.name.split('::').last}"
clazz.logger = Lumber.find_or_create_logger(fullname)
break
\ No newline at end of file