Sha256: b8b4bbfbafa7c27d4e7585b0d7a466bebb35538d95c911af7414f4163628d269

Contents?: true

Size: 790 Bytes

Versions: 51

Compression:

Stored size: 790 Bytes

Contents

require 'set'

module Logging
  module Filters

    # 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.
    class Level < ::Logging::Filter

      # 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)
      #
      def initialize( *levels )
        levels  = levels.map { |level| ::Logging::level_num(level) }
        @levels = Set.new levels
      end

      def allow( event )
        @levels.include?(event.level) ? event : nil
      end

    end
  end
end

Version data entries

51 entries across 43 versions & 4 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/lib/logging/filters/level.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/lib/logging/filters/level.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/lib/logging/filters/level.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/lib/logging/filters/level.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/lib/logging/filters/level.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/lib/logging/filters/level.rb
logging-2.3.0 lib/logging/filters/level.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/lib/logging/filters/level.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/lib/logging/filters/level.rb