Add test that `import torch` doesn't modify global logging state (#87629)
Fixes https://github.com/pytorch/pytorch/issues/87626
Also adds the same test for `import functorch`. Users have complained at
us when we do modify the global logging state, which has happened in the
past.
Test Plan:
- tested locally; I added `logging.basicConfig` to `torch/__init__.py`
and checked that the test got triggered
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87629
Approved by: https://github.com/albanD