Skip to content

Commit

Permalink
Add another test for logging dicts
Browse files Browse the repository at this point in the history
Scraped from #188
  • Loading branch information
wrouesnel authored and hynek committed Feb 2, 2019
1 parent 8917d5d commit 44ccae2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,28 @@ def test_foreign_pre_chain_add_logger_name(self, configure_for_pf, capsys):
"e_chain_add_logger_name]\n",
) == capsys.readouterr()

def test_foreign_chain_can_pass_dictionaries_without_excepting(
self, configure_for_pf, capsys
):
"""
If a foreign logger passes a dictionary to a logging function,
check we correctly identify that it did not come from structlog.
"""
configure_logging(None)
configure(
processors=[ProcessorFormatter.wrap_for_formatter],
logger_factory=LoggerFactory(),
wrapper_class=BoundLogger,
)

logging.getLogger().warning({"foo": "bar"})

assert (
"",
"{'foo': 'bar'} [in "
"test_foreign_chain_can_pass_dictionaries_without_excepting]\n",
) == capsys.readouterr()

def test_foreign_pre_chain_gets_exc_info(self, configure_for_pf, capsys):
"""
If non-structlog record contains exc_info, foreign_pre_chain functions
Expand Down

0 comments on commit 44ccae2

Please sign in to comment.