CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\RequestLogger Class Reference

Handles logging information about requests made to various destinations, such as monolog, EventBus and statsd. More...

Public Member Functions

 hasQueryLogs ()
 
 addRequest (RequestLog $log, ?UserIdentity $user=null, $slowMillis=null)
 
 appendLastLogPayload ( $key, $value)
 
 getQueryTypesUsed ()
 Report the types of queries that were issued within the current request.
 
 setResultPages (array $matches)
 This is set externally because we don't have complete control, from the SearchEngine interface, of what is actually sent to the user.
 

Detailed Description

Handles logging information about requests made to various destinations, such as monolog, EventBus and statsd.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Member Function Documentation

◆ addRequest()

CirrusSearch\RequestLogger::addRequest ( RequestLog $log,
?UserIdentity $user = null,
$slowMillis = null )
Parameters
RequestLog$logThe log about a network request to be added
User | null$userThe user performing the request, or null for actions that don't have a user (such as index updates).
int | null$slowMillisThe threshold in ms after which the request will be considered slow.
Returns
array A map of information about the performed request, suitible for use as a psr-3 log context.

◆ appendLastLogPayload()

CirrusSearch\RequestLogger::appendLastLogPayload ( $key,
$value )
Parameters
string$key
string$value

◆ getQueryTypesUsed()

CirrusSearch\RequestLogger::getQueryTypesUsed ( )

Report the types of queries that were issued within the current request.

Returns
string[]

◆ hasQueryLogs()

CirrusSearch\RequestLogger::hasQueryLogs ( )
Returns
bool True when logs have been generated during the current php execution.

◆ setResultPages()

CirrusSearch\RequestLogger::setResultPages ( array $matches)

This is set externally because we don't have complete control, from the SearchEngine interface, of what is actually sent to the user.

Instead hooks receive the final results that will be sent to the user and set them here.

Accepts two result sets because some places (Special:Search) perform multiple searches. This can be called multiple times, but only that last call wins. For API's that is correct, for Special:Search a hook catches the final results and sets them here.

Parameters
ISearchResultSet[]$matches

The documentation for this class was generated from the following file: