Horde_Log_Filter_Constraint
in package
implements
Horde_Log_Filter
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, mixed>
- 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() : Horde_Log_Filter_Constraint
- Add a constraint to the filter
- addRegex() : Horde_Log_Filter_Constraint
- Add a regular expression to filter by
- addRequiredField() : Horde_Log_Filter_Constraint
- Add a required field to the filter
- addRequiredFields() : Horde_Log_Filter_Constraint
- Adds all arguments passed as required fields
Properties
$_constraints
Constraint list.
protected
array<string|int, mixed>
$_constraints
= array()
$_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(array<string|int, mixed> $event) : bool
Parameters
- $event : array<string|int, mixed>
-
Log event.
Return values
bool —accepted?
addConstraint()
Add a constraint to the filter
public
addConstraint(string $field, Horde_Constraint $constraint) : Horde_Log_Filter_Constraint
Parameters
- $field : string
-
The field to apply the constraint to.
- $constraint : Horde_Constraint
-
The constraint to apply.
Return values
Horde_Log_Filter_Constraint —A reference to $this to allow method chaining.
addRegex()
Add a regular expression to filter by
public
addRegex(string $field, string $regex) : Horde_Log_Filter_Constraint
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
Horde_Log_Filter_Constraint —A reference to $this to allow method chaining.
addRequiredField()
Add a required field to the filter
public
addRequiredField(string $field) : Horde_Log_Filter_Constraint
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
Horde_Log_Filter_Constraint —A reference to $this to allow method chaining.
addRequiredFields()
Adds all arguments passed as required fields
public
addRequiredFields() : Horde_Log_Filter_Constraint
Return values
Horde_Log_Filter_Constraint —A reference to $this to allow method chaining.