| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/Filterable.R |
| 3 |
\name{Filterable} |
| 4 |
\alias{Filterable} |
| 5 |
\title{Abstract Class for Filterables} |
| 6 |
\description{ |
| 7 |
Superclass for classes that have a \verb{$filter()} method such as |
| 8 |
\link{Appenders} and \link{Loggers}. See \link{EventFilter} for details. |
| 9 |
|
| 10 |
\strong{NOTE}: This is an \emph{abstract class}. Abstract classes cannot be instantiated |
| 11 |
directly, but are exported for package developers that want to extend lgr - |
| 12 |
for example by creating their own \link[=Appender]{Appenders} or \link[=Layout]{Layouts}. |
| 13 |
Please refer to the \emph{see also} section for actual implementations of this |
| 14 |
class. |
| 15 |
} |
| 16 |
\seealso{ |
| 17 |
Other abstract classes: |
| 18 |
\code{\link{Appender}}, |
| 19 |
\code{\link{AppenderMemory}}, |
| 20 |
\code{\link{AppenderTable}} |
| 21 |
} |
| 22 |
\concept{abstract classes} |
| 23 |
\section{Active bindings}{ |
| 24 |
\if{html}{\out{<div class="r6-active-bindings">}} |
| 25 |
\describe{ |
| 26 |
\item{\code{filters}}{a \code{list} of all attached Filters.} |
| 27 |
} |
| 28 |
\if{html}{\out{</div>}} |
| 29 |
} |
| 30 |
\section{Methods}{ |
| 31 |
\subsection{Public methods}{ |
| 32 |
\itemize{ |
| 33 |
\item \href{#method-Filterable-filter}{\code{Filterable$filter()}} |
| 34 |
\item \href{#method-Filterable-add_filter}{\code{Filterable$add_filter()}} |
| 35 |
\item \href{#method-Filterable-remove_filter}{\code{Filterable$remove_filter()}} |
| 36 |
\item \href{#method-Filterable-set_filters}{\code{Filterable$set_filters()}} |
| 37 |
} |
| 38 |
} |
| 39 |
\if{html}{\out{<hr>}} |
| 40 |
\if{html}{\out{<a id="method-Filterable-filter"></a>}} |
| 41 |
\if{latex}{\out{\hypertarget{method-Filterable-filter}{}}} |
| 42 |
\subsection{Method \code{filter()}}{ |
| 43 |
Determine whether the LogEvent \code{x} should be passed on to |
| 44 |
Appenders (\code{TRUE}) or not (\code{FALSE}). See also the active binding |
| 45 |
\code{filters}. |
| 46 |
\subsection{Usage}{ |
| 47 |
\if{html}{\out{<div class="r">}}\preformatted{Filterable$filter(event)}\if{html}{\out{</div>}} |
| 48 |
} |
| 49 |
|
| 50 |
\subsection{Arguments}{ |
| 51 |
\if{html}{\out{<div class="arguments">}} |
| 52 |
\describe{ |
| 53 |
\item{\code{event}}{a \link{LogEvent}} |
| 54 |
} |
| 55 |
\if{html}{\out{</div>}} |
| 56 |
} |
| 57 |
} |
| 58 |
\if{html}{\out{<hr>}} |
| 59 |
\if{html}{\out{<a id="method-Filterable-add_filter"></a>}} |
| 60 |
\if{latex}{\out{\hypertarget{method-Filterable-add_filter}{}}} |
| 61 |
\subsection{Method \code{add_filter()}}{ |
| 62 |
Attach a filter |
| 63 |
\subsection{Usage}{ |
| 64 |
\if{html}{\out{<div class="r">}}\preformatted{Filterable$add_filter(filter, name = NULL)}\if{html}{\out{</div>}} |
| 65 |
} |
| 66 |
|
| 67 |
\subsection{Arguments}{ |
| 68 |
\if{html}{\out{<div class="arguments">}} |
| 69 |
\describe{ |
| 70 |
\item{\code{filter}}{\itemize{ |
| 71 |
\item a function with the single argument \code{event} that returns \code{TRUE} |
| 72 |
or \code{FALSE}; |
| 73 |
\item an \link{EventFilter} \link[R6:R6Class]{R6::R6} object; or |
| 74 |
\item any \R object with a \verb{$filter()} method. |
| 75 |
} |
| 76 |
|
| 77 |
If a Filter returns a non-\code{FALSE} value, will be interpreted as \code{TRUE} |
| 78 |
(= no filtering takes place) and a warning will be thrown.} |
| 79 |
|
| 80 |
\item{\code{name}}{\code{character} scalar or \code{NULL}. An optional |
| 81 |
name which makes it easier to access (or remove) the filter} |
| 82 |
} |
| 83 |
\if{html}{\out{</div>}} |
| 84 |
} |
| 85 |
} |
| 86 |
\if{html}{\out{<hr>}} |
| 87 |
\if{html}{\out{<a id="method-Filterable-remove_filter"></a>}} |
| 88 |
\if{latex}{\out{\hypertarget{method-Filterable-remove_filter}{}}} |
| 89 |
\subsection{Method \code{remove_filter()}}{ |
| 90 |
Remove a filter |
| 91 |
\subsection{Usage}{ |
| 92 |
\if{html}{\out{<div class="r">}}\preformatted{Filterable$remove_filter(pos)}\if{html}{\out{</div>}} |
| 93 |
} |
| 94 |
|
| 95 |
\subsection{Arguments}{ |
| 96 |
\if{html}{\out{<div class="arguments">}} |
| 97 |
\describe{ |
| 98 |
\item{\code{pos}}{\code{character} or \code{integer} scalar. The name or index of the |
| 99 |
Filter to be removed.} |
| 100 |
} |
| 101 |
\if{html}{\out{</div>}} |
| 102 |
} |
| 103 |
} |
| 104 |
\if{html}{\out{<hr>}} |
| 105 |
\if{html}{\out{<a id="method-Filterable-set_filters"></a>}} |
| 106 |
\if{latex}{\out{\hypertarget{method-Filterable-set_filters}{}}} |
| 107 |
\subsection{Method \code{set_filters()}}{ |
| 108 |
Set or replace (all) Filters of parent object. See |
| 109 |
\link{EventFilter} for how Filters work. |
| 110 |
\subsection{Usage}{ |
| 111 |
\if{html}{\out{<div class="r">}}\preformatted{Filterable$set_filters(filters)}\if{html}{\out{</div>}} |
| 112 |
} |
| 113 |
|
| 114 |
\subsection{Arguments}{ |
| 115 |
\if{html}{\out{<div class="arguments">}} |
| 116 |
\describe{ |
| 117 |
\item{\code{filters}}{a \code{list} (named or unnamed) of \link[=EventFilter]{EventFilters} |
| 118 |
or predicate functions. See \code{\link[=is_filter]{is_filter()}}.} |
| 119 |
} |
| 120 |
\if{html}{\out{</div>}} |
| 121 |
} |
| 122 |
} |
| 123 |
} |