bug: #3629730: Mapillary Logs: error logging only works when API call logging is on

Closes #3629730

Changes

  • MapillaryLogsService::logApiCall(): a failed call is gated by log_errors alone; log_api_calls now 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.
  • MapillaryLogsHooks logs every content entity type provided by mapillary or a mapillary_* 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_logs service, and the dblog and mapillary_entity dependencies. mapillary_field stays, because the event classes live there.
  • Removed the nonexistent administer mapillary_logs permission from README.md and AGENTS.md; the settings route uses administer mapillary.

Upgrade path

  • mapillary_logs_post_update_remove_logger_channel(): empty, so drush updb rebuilds the container after the service removal.
  • Removing the dependencies does not uninstall dblog or mapillary_entity on existing sites.
  • No config or schema changes. CHANGELOG notes that a default install now logs failed API requests.

Tests

  • Unit: MapillaryLogsServiceTest covers an error logged with log_api_calls off, no error with log_errors off, and the placeholder messages. MapillaryLogsHooksTest covers map features, detections, a config entity and a module whose name only starts with mapillary.
  • Kernel: MapillaryLogsEventSubscriberTest and MapillaryLogsCrudTest read the rendered messages through a new WatchdogMessagesTrait, 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_logs passes 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:

  • MapillaryApiClient also writes errors to its own mapillary_field channel, 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.

Merge request reports

Loading
Loading