Loading
bug: #3629730: Mapillary Logs: error logging only works when API call logging is on
Closes #3629730
Changes
MapillaryLogsService::logApiCall(): a failed call is gated bylog_errorsalone;log_api_callsnow only gates successful calls. With the default settings (log_api_calls: false,log_errors: true) failed API requests are logged.- All three message types (API call, entity CRUD, viewer render) pass their variable parts as placeholders, so Recent log messages groups them and they can be translated.
MapillaryLogsHookslogs every content entity type provided bymapillaryor amapillary_*module instead of a hardcoded list. Map features and detections are now included; bundle config entities are not.- Corrected the "Log errors" and "Log entity CRUD" descriptions on the settings form.
- Removed the unused
logger.channel.mapillary_logsservice, and thedblogandmapillary_entitydependencies.mapillary_fieldstays, because the event classes live there. - Removed the nonexistent
administer mapillary_logspermission fromREADME.mdandAGENTS.md; the settings route usesadminister mapillary.
Upgrade path
mapillary_logs_post_update_remove_logger_channel(): empty, sodrush updbrebuilds the container after the service removal.- Removing the dependencies does not uninstall
dblogormapillary_entityon existing sites. - No config or schema changes. CHANGELOG notes that a default install now logs failed API requests.
Tests
- Unit:
MapillaryLogsServiceTestcovers an error logged withlog_api_callsoff, no error withlog_errorsoff, and the placeholder messages.MapillaryLogsHooksTestcovers map features, detections, a config entity and a module whose name only starts withmapillary. - Kernel:
MapillaryLogsEventSubscriberTestandMapillaryLogsCrudTestread the rendered messages through a newWatchdogMessagesTrait, since the stored message is now a template. New cases: error logged with API call logging off, no error with error logging off, bundle config entity not logged, stored message is the template. mapillary_logspasses phpcs (Drupal, DrupalPractice) and phpstan level 6, tests included.
Out of scope
These belong to the API client, which is planned to move to the base module in a follow-up:
MapillaryApiClientalso writes errors to its ownmapillary_fieldchannel, so an error is logged twice while Mapillary Logs is enabled.- A missing access token dispatches no event, so it is not logged here.
- Expected errors such as 404 are still logged at error level.