Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
WikiProcessor | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
__invoke | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | namespace MediaWiki\Logger\Monolog; |
22 | |
23 | use MediaWiki\Http\Telemetry; |
24 | use MediaWiki\WikiMap\WikiMap; |
25 | |
26 | /** |
27 | * Annotate log records with request-global metadata, such as the hostname, |
28 | * wiki / request ID, and MediaWiki version. |
29 | * |
30 | * @since 1.25 |
31 | * @ingroup Debug |
32 | * @copyright © 2013 Wikimedia Foundation and contributors |
33 | */ |
34 | class WikiProcessor { |
35 | |
36 | /** |
37 | * @param array $record |
38 | * @return array |
39 | */ |
40 | public function __invoke( array $record ) { |
41 | $telemetry = Telemetry::getInstance(); |
42 | $record['extra']['host'] = wfHostname(); |
43 | $record['extra']['wiki'] = WikiMap::getCurrentWikiId(); |
44 | $record['extra']['mwversion'] = MW_VERSION; |
45 | $record['extra']['reqId'] = $telemetry->getRequestId(); |
46 | if ( wfIsCLI() && isset( $_SERVER['argv'] ) ) { |
47 | $record['extra']['cli_argv'] = implode( ' ', $_SERVER['argv'] ); |
48 | } |
49 | return $record; |
50 | } |
51 | |
52 | } |