EventFilters specify arbitrarily complex logic for whether or
not a LogEvent should be processed by a Logger or Appender. They are
attached to Loggers/Appenders via their $set_filter()
or $add_filter()
methods. If any EventFilter evaluates to FALSE
for a given event, that
event is ignored - similarly to when it does not pass the objects'
threshold.
Usually you do not need to instantiate a formal EventFilter
object as you
can just use any function
that has the single argument event
instead.
If you need to implement more complex filter logic - for example a filter
that is dependent on a dataset - it might be desirable to subclass
EventFilter, as R6::R6 objects can store data and functions together.
.obj()
is a special function that can only be used within the
$filter()
methods of EventFilters. It returns the Logger
or Appender that the EventFilter is attached to.