Skip to content

Commit d793776

Browse files
authored
Merge pull request #15 from itk-dev/feature/update-logging-messages
ITKDev: Update Serviceplatformen audit logging messages
2 parents 9126c98 + 0b9fc2e commit d793776

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/Plugin/os2web/DataLookup/ServiceplatformenBase.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,28 @@ protected function query(string $method, array $request): array {
294294
];
295295
}
296296

297+
// Prepare request data for logging.
298+
if (in_array($method, ['callCPRBasicInformationService', 'PersonLookup'])) {
299+
$auditLoggingMethodParameter = 'PNR, ' . $request['PNR'] ?? '';
300+
}
301+
elseif ($method === 'getLegalUnit') {
302+
$auditLoggingMethodParameter = 'LegalUnitIdentifier, ' . $request['GetLegalUnitRequest']['LegalUnitIdentifier'] ?? '';
303+
}
304+
elseif ($method === 'getProductionUnit') {
305+
$auditLoggingMethodParameter = 'ProductionUnitIdentifier, ' . $request['GetProductionUnitRequest']['ProductionUnitIdentifier'] ?? '';
306+
}
307+
else {
308+
$auditLoggingMethodParameter = sprintf('Unhandled method: %s', $method);
309+
}
310+
297311
try {
298-
$msg = sprintf('Method %s called with (%s)', $method, implode(', ', $request));
312+
$msg = sprintf('Method %s called with (%s)', $method, $auditLoggingMethodParameter);
299313
$this->auditLogger->info('DataLookup', $msg);
300314
$response = (array) $this->client->$method($request);
301315
$response['status'] = TRUE;
302316
}
303317
catch (\SoapFault $e) {
304-
$msg = sprintf('Method %s called with (%s): %s', $method, implode(', ', $request), $e->faultstring);
318+
$msg = sprintf('Method %s called with (%s): %s', $method, $auditLoggingMethodParameter, $e->faultstring);
305319
$this->auditLogger->error('DataLookup', $msg);
306320
$response = [
307321
'status' => FALSE,

0 commit comments

Comments
 (0)