Class: Logging::Filters::Level

### Home Classes Methods

### In Files

- lib/logging/filters/level.rb

### Parent

Logging::Filter

### Methods

- ::new
- #allow

### Files

- History.txt

### Class/Module Index

Quicksearch

- Logging
- Logging::Appender
- Logging::Appenders
- Logging::Appenders::Buffering
- Logging::Appenders::File
- Logging::Appenders::IO
- Logging::Appenders::RollingFile
- Logging::Appenders::RollingFile::Roller
- Logging::Appenders::Stderr
- Logging::Appenders::Stdout
- Logging::Appenders::StringIo
- Logging::Appenders::Syslog
- Logging::ColorScheme
- Logging::Filter
- Logging::Filters
- Logging::Filters::Level
- 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
- RSpec
- RSpec::Core
- RSpec::Core::Configuration
- RSpec::LoggingHelper
- RSpec::LoggingHelper
- Spec
- Spec::Runner
- Spec::Runner::Configuration
- Object
- Object::LoggingHelper
- File
- FileUtils
- Module
- ReentrantMutex
- String

No matching classes.

# Logging::Filters::Level

The `Level` filter class provides a simple level-based filtering mechanism that filters messages to only include those from an enumerated list of levels to log.

### Public Class Methods

new( *levels ) click to toggle source

Creates a new level filter that will only allow the given levels to propagate through to the logging destination. The levels should be given in symbolic form.

Examples

    Logging::Filters::Level.new(:debug, :info)

    # File lib/logging/filters/level.rb, line 18
    def initialize( *levels )
      levels  = levels.map { |level| ::Logging::level_num(level) }
      @levels = Set.new levels
    end

### Public Instance Methods

allow( event ) click to toggle source

    # File lib/logging/filters/level.rb, line 23
    def allow( event )
      @levels.include?(event.level) ? event : nil
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.