# Refactor: remove unused _logger fields from repositories (or use them)

**Task**: AZ-378_refactor_repo_logger_fields
**Name**: Repo loggers — delete or use
**Description**: Either delete the unused `_logger` injection from each repository or use it for a slow-query warning. Recommended split: use it in `TileRepository.GetTilesByRegionAsync`; delete elsewhere.
**Complexity**: 1 point
**Dependencies**: None
**Component**: DataAccess
**Tracker**: AZ-378
**Epic**: AZ-350

## Problem

`SatelliteProvider.DataAccess/Repositories/TileRepository.cs:11`, `RegionRepository.cs:11`, and `RouteRepository.cs` each accept and store `ILogger<TRepo>` but never read the field. Dead injection adds DI cost and noise without value.

## Outcome

- Repositories that keep `_logger` actually use it (e.g., slow-query warning).
- Repositories that don't keep it have the field, parameter, and DI registration removed.
- 37 unit + 5 smoke tests stay green.

## Scope

### Included
- Recommended: `TileRepository.GetTilesByRegionAsync` measures query duration and emits `_logger.LogWarning` if it exceeds a threshold (e.g., 500 ms — make it a const with a comment).
- Delete `_logger` from `RegionRepository`, `RouteRepository`, and any other repository where it isn't used.
- Update DI registrations in `Program.cs` for the deleted ones.

### Excluded
- Adding structured query telemetry beyond the slow-query warning.
- Promoting the warning to a metric (deferred).

## Acceptance Criteria

**AC-1: Kept loggers are used**
Given the post-refactor source
When `_logger` survives in any repository
Then it is read at least once in that file.

**AC-2: Unused loggers are removed**
Given each remaining repository
When the constructor is inspected
Then there is no unused `ILogger<TRepo>` parameter.

**AC-3: Tests stay green**
Given the post-refactor build
When `scripts/run-tests.sh --smoke` runs
Then all 37 unit + 5 smoke scenarios pass.

## Constraints

- No public API change.

## Risks & Mitigation

**Risk 1: slow-query threshold is arbitrary**
- *Risk*: 500 ms may be too tight or too loose.
- *Mitigation*: make it a named const with a short comment; tune later as needed.

Full change entry: `_docs/04_refactoring/03-code-quality-refactoring/list-of-changes.md` (C25).
