Sha256: 46a26ed313d87afe6ed704d9a9b64c650e6f444c1068c7a53681d3619d26c018

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

# $Id: static_appender.rb 85 2008-02-06 17:59:00Z tim_pease $

module Logging
class Appender

  @appenders = Hash.new

  class << self

    # call-seq:
    #    Appender[name]
    #
    # Returns the appender instance stroed in the Appender hash under the
    # key _name_, or +nil+ if no appender has been created using that name.
    #
    def []( name ) @appenders[name] end

    # call-seq:
    #    Appender[name] = appender
    #
    # Stores the given _appender_ instance in the Appender hash under the
    # key _name_.
    #
    def []=( name, val ) @appenders[name] = val end

    # call-seq:
    #    Appenders.remove( name )
    #
    # Removes the appender instance stored in the Appender hash under the
    # key _name_.
    #
    def remove( name ) @appenders.delete(name) end

    # call-seq:
    #    Appender.stdout
    #
    # Returns an instance of the Stdout Appender. Unless the user explicitly
    # creates a new Stdout Appender, the instance returned by this method
    # will always be the same:
    #
    #    Appender.stdout.object_id == Appender.stdout.object_id    #=> true
    #
    def stdout( ) self['stdout'] || ::Logging::Appenders::Stdout.new end

    # call-seq:
    #    Appender.stderr
    #
    # Returns an instance of the Stderr Appender. Unless the user explicitly
    # creates a new Stderr Appender, the instance returned by this method
    # will always be the same:
    #
    #    Appender.stderr.object_id == Appender.stderr.object_id    #=> true
    #
    def stderr( ) self['stderr'] || ::Logging::Appenders::Stderr.new end

  end  # class << self
end  # class Appender
end  # module Logging

# EOF

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logging-0.6.2 lib/logging/appenders/static_appender.rb