Skip to content

Commit

Permalink
Avoid double shutdown of logger provider (#878)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki authored Feb 20, 2025
1 parent a40636b commit a45d51a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions logfire/_internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,9 +1017,9 @@ def fix_pid(): # pragma: no cover
logger_provider.add_log_record_processor(root_log_processor)

with contextlib.suppress(Exception):
# This also shuts down the underlying self._logger_provider
self._event_logger_provider.shutdown()
with contextlib.suppress(Exception):
self._logger_provider.shutdown()

self._logger_provider.set_provider(logger_provider)

if self is GLOBAL_CONFIG and not self._has_set_providers:
Expand Down
5 changes: 5 additions & 0 deletions tests/test_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
PROCESS_RUNTIME_VERSION_REGEX = r'(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'


@pytest.fixture(autouse=True)
def no_log_on_config(config: None, caplog: pytest.LogCaptureFixture) -> None:
assert not caplog.messages


def test_propagate_config_to_tags(exporter: TestExporter) -> None:
tags1 = logfire.with_tags('tag1', 'tag2')
tags2 = logfire.with_tags('tag3', 'tag4')
Expand Down

0 comments on commit a45d51a

Please sign in to comment.