ConstraintFilter
in package
implements
LogFilter
Filters log events using defined constraints on one or more fields of the $event array.
Tags
Interfaces, Classes, Traits and Enums
Table of Contents
- $constraints : array<string|int, Horde_Constraint_Coupler>
- Constraint list.
- $coupler : Horde_Constraint_Coupler
- Default constraint coupler.
- __construct() : mixed
- Constructor.
- accept() : bool
- Returns Horde_Log_Filter::ACCEPT to accept the message, Horde_Log_Filter::IGNORE to ignore it.
- addConstraint() : ConstraintFilter
- Add a constraint to the filter.
- addRegex() : ConstraintFilter
- Add a regular expression to filter by.
- addRequiredField() : ConstraintFilter
- Add a required field to the filter.
- addRequiredFields() : ConstraintFilter
- Adds all arguments passed as required fields.
Properties
$constraints
Constraint list.
protected
array<string|int, Horde_Constraint_Coupler>
$constraints
= []
$coupler
Default constraint coupler.
protected
Horde_Constraint_Coupler
$coupler
Tags
Methods
__construct()
Constructor.
public
__construct([Horde_Constraint_Coupler $coupler = null ]) : mixed
Parameters
- $coupler : Horde_Constraint_Coupler = null
-
The default kind of constraint to use to couple multiple constraints. Defaults to And.
Return values
mixed —accept()
Returns Horde_Log_Filter::ACCEPT to accept the message, Horde_Log_Filter::IGNORE to ignore it.
public
accept(LogMessage $event) : bool
Parameters
- $event : LogMessage
-
Log event.
Return values
bool —accepted?
addConstraint()
Add a constraint to the filter.
public
addConstraint(string $field, Horde_Constraint $constraint) : ConstraintFilter
Parameters
- $field : string
-
The field to apply the constraint to.
- $constraint : Horde_Constraint
-
The constraint to apply.
Return values
ConstraintFilter —A reference to $this to allow method chaining.
addRegex()
Add a regular expression to filter by.
public
addRegex(string $field, string $regex) : ConstraintFilter
Takes a field name and a regex, if the regex does not match then the event is filtered.
Parameters
- $field : string
-
The name of the field that should be part of the event.
- $regex : string
-
The regular expression to filter by.
Return values
ConstraintFilter —A reference to $this to allow method chaining.
addRequiredField()
Add a required field to the filter.
public
addRequiredField(string $field) : ConstraintFilter
If the field does not exist on the event, then it is filtered.
Parameters
- $field : string
-
The name of the field that should be part of the event.
Return values
ConstraintFilter —A reference to $this to allow method chaining.
addRequiredFields()
Adds all arguments passed as required fields.
public
addRequiredFields() : ConstraintFilter
Return values
ConstraintFilter —A reference to $this to allow method chaining.