Skip to content

Commit

Permalink
✨ Enable pretty-printed exceptions for local development
Browse files Browse the repository at this point in the history
  • Loading branch information
TeoZosa committed Oct 28, 2021
1 parent 26b599d commit 0af9bec
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
1 change: 0 additions & 1 deletion structlog_sentry_logger/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def set_structlog_config(timestamper: structlog.processors.TimeStamper) -> None:
structlog_processors = [
timestamper,
structlog.processors.StackInfoRenderer(),
structlog.processors.format_exc_info,
add_severity_field_from_level_if_in_cloud_environment,
]
stdlib_log_compatibility_processors = [
Expand Down
10 changes: 1 addition & 9 deletions tests/docs_src/test_sentry_integration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from pathlib import Path
from typing import List

import pytest
Expand All @@ -15,8 +14,6 @@

@pytest.fixture(scope="function")
def expected_output_truncated() -> List[JSONOutputType]:
project_root_dir = Path(__file__).parents[2]
file_under_test = str(Path(f"{project_root_dir}/docs_src/sentry_integration.py"))
return [
{
"event": "A dummy error for testing purposes is about to be thrown!\n",
Expand All @@ -25,16 +22,11 @@ def expected_output_truncated() -> List[JSONOutputType]:
"sentry": "skipped",
},
{
"exc_info": True,
"event": (
"I threw an error on purpose for this example!\n"
"Now throwing another that explicitly chains from that one!\n"
),
"exception": (
"Traceback (most recent call last):\n "
f'File "{file_under_test}"'
f", line 13, in <module>\n"
" x = 1 / 0\nZeroDivisionError: division by zero"
),
"level": "error",
"logger": "docs_src.sentry_integration",
"sentry": "sent",
Expand Down
1 change: 0 additions & 1 deletion tests/structlog_sentry_logger/test__config.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ def test_sentry_DSN_integration(caplog: LogCaptureFixture) -> None:
if isinstance(log, dict): # structlog logger
assert log["level"] == "error" == record.levelname.lower()
assert log["sentry"] == "sent"
assert err_msg in log["exception"]
assert "sentry_id" in log
elif isinstance(log, str):
# other stdlib-based logger initialized BEFORE our structlog logger;
Expand Down

0 comments on commit 0af9bec

Please sign in to comment.