Don't try to use structured data in structured logging, it doesn't work

Our log messages were being silently dropped. Experimentation revealed
that our structured logging system doesn't actually like it when we
try to log structured data.

See: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/540464/3/includes/ApiVisualEditorEdit.php

Put it all in the message strings, whatever.

Change-Id: Iae778f95774df2e24b30387221e39e097e25a4cf
This commit is contained in:
Bartosz Dziewoński 2019-10-02 23:13:29 +02:00
parent df0c8ad02d
commit 04407e9eb1
2 changed files with 6 additions and 13 deletions

View file

@ -134,16 +134,13 @@ class ApiVisualEditor extends ApiBase {
);
} else {
// error null, code not 200
$trace = ( new Exception )->getTraceAsString();
$this->logger->warning(
__METHOD__ . ": Received HTTP {code} from RESTBase",
[
'code' => $response['code'],
'trace' => ( new Exception )->getTraceAsString(),
'response' => $response['body'],
'requestPath' => $path,
__METHOD__ . ": Received HTTP {$response['code']} from RESTBase for $path." .
" Trace: {$trace}" .
" Response: {$response['body']}" .
/** @phan-suppress-next-line PhanTypeInvalidDimOffset */
'requestIfMatch' => $reqheaders['If-Match'] ?? '',
]
" Request If-Match: {$reqheaders['If-Match']}"
);
$this->dieWithError(
[ 'apierror-visualeditor-docserver-http', $response['code'] ],

View file

@ -288,11 +288,7 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
"?$
/x', $etag ) ) {
$this->logger->info(
__METHOD__ . ": Received funny ETag from client: {etag}",
[
'etag' => $etag,
'requestPath' => $path,
]
__METHOD__ . ": Received funny ETag from client: $etag for $path"
);
}
return $this->requestRestbase(