module Logging::Appenders

Constants

Stderr

This class provides an Appender that can write to STDERR.

Stdout

This class provides an Appender that can write to STDOUT.

Public Class Methods

file( *args ) click to toggle source

Accessor / Factory for the File appender.

# File lib/logging/appenders/file.rb, line 6
def self.file( *args )
  fail ArgumentError, '::Logging::Appenders::File needs a name as first argument.' if args.empty?
  ::Logging::Appenders::File.new(*args)
end
io( *args ) click to toggle source

Accessor / Factory for the IO appender.

# File lib/logging/appenders/io.rb, line 6
def self.io( *args )
  return ::Logging::Appenders::IO if args.empty?
  ::Logging::Appenders::IO.new(*args)
end
rolling_file( *args ) click to toggle source

Accessor / Factory for the RollingFile appender.

# File lib/logging/appenders/rolling_file.rb, line 4
def self.rolling_file( *args )
  fail ArgumentError, '::Logging::Appenders::RollingFile needs a name as first argument.' if args.empty?
  ::Logging::Appenders::RollingFile.new(*args)
end
stderr( *args ) click to toggle source

Accessor / Factory for the Stderr appender.

# File lib/logging/appenders/console.rb, line 56
def self.stderr( *args )
  if args.empty?
    return self['stderr'] || ::Logging::Appenders::Stderr.new
  end
  ::Logging::Appenders::Stderr.new(*args)
end
stdout( *args ) click to toggle source

Accessor / Factory for the Stdout appender.

# File lib/logging/appenders/console.rb, line 47
def self.stdout( *args )
  if args.empty?
    return self['stdout'] || ::Logging::Appenders::Stdout.new
  end
  ::Logging::Appenders::Stdout.new(*args)
end
string_io( *args ) click to toggle source

Accessor / Factory for the StringIo appender.

# File lib/logging/appenders/string_io.rb, line 6
def self.string_io( *args )
  return ::Logging::Appenders::StringIo if args.empty?
  ::Logging::Appenders::StringIo.new(*args)
end
syslog( *args ) click to toggle source

Accessor / Factory for the Syslog appender.

# File lib/logging/appenders/syslog.rb, line 11
def self.syslog( *args )
  fail ArgumentError, '::Logging::Appenders::Syslog needs a name as first argument.' if args.empty?
  ::Logging::Appenders::Syslog.new(*args)
end

Public Instance Methods

Appenders[name] click to toggle source

Returns the appender instance stored in the appender hash under the key name, or nil if no appender has been created using that name.

# File lib/logging/appenders.rb, line 11
def []( name ) @appenders[name] end
Appenders[name] = appender click to toggle source

Stores the given appender instance in the appender hash under the key name.

# File lib/logging/appenders.rb, line 19
def []=( name, value ) @appenders[name] = value end
each {|appender| block} click to toggle source

Yield each appender to the block.

# File lib/logging/appenders.rb, line 34
def each( &block )
  @appenders.values.each(&block)
  return nil
end
remove( name ) click to toggle source

Removes the appender instance stored in the appender hash under the key name.

# File lib/logging/appenders.rb, line 27
def remove( name ) @appenders.delete(name) end