MCPcopy Create free account
hub / github.com/hynek/structlog / test_recreate_defaults

Function test_recreate_defaults

tests/test_stdlib.py:1669–1689  ·  view source on GitHub ↗

Recreate defaults configures structlog and -- if asked -- logging.

(log_level)

Source from the content-addressed store, hash-verified

1667
1668@pytest.mark.parametrize("log_level", [None, 45])
1669def test_recreate_defaults(log_level):
1670 """
1671 Recreate defaults configures structlog and -- if asked -- logging.
1672 """
1673 logging.basicConfig(
1674 stream=sys.stderr,
1675 level=1,
1676 force=True,
1677 )
1678
1679 recreate_defaults(log_level=log_level)
1680
1681 assert BoundLogger is _CONFIG.default_wrapper_class
1682 assert dict is _CONFIG.default_context_class
1683 assert isinstance(_CONFIG.logger_factory, LoggerFactory)
1684
1685 log = get_logger().bind()
1686 if log_level is not None:
1687 assert log_level == log.getEffectiveLevel()
1688 else:
1689 assert 1 == log.getEffectiveLevel()

Callers

nothing calls this directly

Calls 4

recreate_defaultsFunction · 0.90
get_loggerFunction · 0.90
getEffectiveLevelMethod · 0.80
bindMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…