Class: Module

### Home Classes Methods

### In Files

- lib/logging/utils.rb

### Parent

Object

### Methods

- #logger_name

### Files

- History.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Logging
- Logging::Appender
- Logging::Appenders
- Logging::Appenders::Buffering
- Logging::Appenders::Email
- Logging::Appenders::File
- Logging::Appenders::Growl
- Logging::Appenders::IO
- Logging::Appenders::RollingFile
- Logging::Appenders::Stderr
- Logging::Appenders::Stdout
- Logging::Appenders::StringIo
- Logging::Appenders::Syslog
- Logging::ColorScheme
- Logging::Config
- Logging::Config::Configurator
- Logging::Config::Configurator::DSL
- Logging::Config::Configurator::Error
- Logging::Config::Configurator::TopLevelDSL
- Logging::Config::YamlConfigurator
- Logging::Config::YamlConfigurator::Error
- Logging::Layout
- Logging::Layouts
- Logging::Layouts::Basic
- Logging::Layouts::Parseable
- Logging::Layouts::Pattern
- Logging::Logger
- Logging::MappedDiagnosticContext
- Logging::NestedDiagnosticContext
- Logging::Proxy
- Logging::RailsCompat
- Logging::Repository
- Logging::Repository::Singleton
- Logging::RootLogger
- Logging::Stats
- Logging::Stats::Sampler
- Logging::Stats::Tracker
- RSpec
- RSpec::Core
- RSpec::Core::Configuration
- RSpec::LoggingHelper
- RSpec::LoggingHelper
- Spec
- Spec::Runner
- Spec::Runner::Configuration
- Object
- Object::LoggingHelper
- File
- FileUtils
- Hash
- Kernel
- Module
- ReentrantMutex
- String

No matching classes.

# Module

### Public Instance Methods

logger_name #=> string click to toggle source

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
    def logger_name
      return name unless name.nil? or name.empty?

      # check if this is a metaclass (or eigenclass)
      if ancestors.include? Class
        inspect =~ /#<Class:([^#>]+)>/
        return $1
      end

      # see if we have a superclass
      if respond_to? :superclass
        return superclass.logger_name
      end

      # we are an anonymous module
      ::Logging.log_internal(-2) {
        'cannot return a predictable, unique name for anonymous modules'
      }
      return 'anonymous'
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.