Skip to content

Commit

Permalink
Fix ignore no config warning message (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
aimanbakour authored Jun 30, 2024
1 parent b19c02a commit 770780d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion logfire/_internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def warn_if_not_initialized(self, message: str):
_frame, stacklevel = get_user_frame_and_stacklevel()
warnings.warn(
f'{message} until `logfire.configure()` has been called. '
f'Set the environment variable LOGFIRE_IGNORE_NO_CONFIG=1 or add ignore_no_config=false in pyproject.toml to suppress this warning.',
f'Set the environment variable LOGFIRE_IGNORE_NO_CONFIG=1 or add ignore_no_config=true in pyproject.toml to suppress this warning.',
category=LogfireNotConfiguredWarning,
stacklevel=stacklevel,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_logfire.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def test_logfire_with_its_own_config(exporter: TestExporter) -> None:

assert str(warnings[0].message) == (
'No logs or spans will be created until `logfire.configure()` has been called. '
'Set the environment variable LOGFIRE_IGNORE_NO_CONFIG=1 or add ignore_no_config=false in pyproject.toml to suppress this warning.'
'Set the environment variable LOGFIRE_IGNORE_NO_CONFIG=1 or add ignore_no_config=true in pyproject.toml to suppress this warning.'
)
assert warnings[0].lineno == inspect.currentframe().f_lineno - 9 # type: ignore

Expand All @@ -913,7 +913,7 @@ def test_logfire_with_its_own_config(exporter: TestExporter) -> None:

assert str(warnings[0].message) == (
'Instrumentation will have no effect until `logfire.configure()` has been '
'called. Set the environment variable LOGFIRE_IGNORE_NO_CONFIG=1 or add ignore_no_config=false in pyproject.toml to suppress '
'called. Set the environment variable LOGFIRE_IGNORE_NO_CONFIG=1 or add ignore_no_config=true in pyproject.toml to suppress '
'this warning.'
)
assert warnings[0].lineno == inspect.currentframe().f_lineno - 7 # type: ignore
Expand Down

0 comments on commit 770780d

Please sign in to comment.