File: filter.rb

package info (click to toggle)
ruby-logging 2.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 660 kB
  • sloc: ruby: 6,139; sh: 11; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Logging

  # The `Filter` class allows for filtering messages based on event
  # properties independently of the standard minimum-level restriction.
  #
  # All other Filters inherit from this class, and must override the
  # `allow` method to return the event if it should be allowed into the log.
  # Otherwise the `allow` method should return `nil`.
  class Filter

    # Returns the event if it should be allowed into the log. Returns `nil` if
    # the event should _not_ be allowed into the log. Subclasses should override
    # this method and provide their own filtering semantics.
    def allow( event )
      event
    end
  end
end