Improve lazy import error messages (#48602)
* Improve lazy import error messages
* Address lazy import review feedback
* Refine lazy import error diagnostics
* Test lazy import debug diagnostics
* Fix lazy import diagnostic formatting
* Use CaptureLogger in lazy import test
* Keep lazy import test logger local
* Format lazy import test
* Apply Ruff formatting to lazy import test
* Fix debug log capture in lazy import test
* Fix lazy import log capture test
* Format lazy import regression test
---------
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>