Object
Returns a predictable logger name for the current module or class. If used within an anonymous class, the first non-anonymous class name will be used as the logger name. If used within a meta-class, the name of the actual class will be used as the logger name. If used within an anonymous module, the string ‘anonymous’ will be returned.
# File lib/logging/utils.rb, line 89 89: def logger_name 90: return name unless name.nil? or name.empty? 91: 92: # check if this is a metaclass (or eigenclass) 93: if ancestors.include? Class 94: inspect =~ /#<Class:([^#>]+)>/ 95: return $1 96: end 97: 98: # see if we have a superclass 99: if respond_to? :superclass 100: return superclass.logger_name 101: end 102: 103: # we are an anonymous module 104: ::Logging.log_internal(2) { 105: 'cannot return a predictable, unique name for anonymous modules' 106: } 107: return 'anonymous' 108: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.