Follows investigation from T172559, where we found that there is no explicit
way to find what script triggered particular error messages when the script
was run from the command-line (as opposed to a web request, where the
built-in WebProcessor adds fields like http_method and url).
Change-Id: Ia9641274a164137dcc30324578d750cc662976ee
*/
public function __invoke( array $record ) {
global $wgVersion;
- $record['extra'] = array_merge(
- $record['extra'],
- [
- 'host' => wfHostname(),
- 'wiki' => wfWikiID(),
- 'mwversion' => $wgVersion,
- 'reqId' => \WebRequest::getRequestId(),
- ]
- );
+ $record['extra']['host'] = wfHostname();
+ $record['extra']['wiki'] = wfWikiID();
+ $record['extra']['mwversion'] = $wgVersion;
+ $record['extra']['reqId'] = \WebRequest::getRequestId();
+ if ( PHP_SAPI === 'cli' && isset( $_SERVER['argv'] ) ) {
+ $record['extra']['cli_argv'] = implode( ' ', $_SERVER['argv'] );
+ }
return $record;
}